1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-15 15:32:53 +08:00

Compare commits

...

115 Commits

77 changed files with 2081 additions and 414 deletions
@@ -0,0 +1,68 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Users;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseResults : TestCase
{
private BeatmapDatabase db;
public override string Description => @"Results after playing.";
[BackgroundDependencyLoader]
private void load(BeatmapDatabase db)
{
this.db = db;
}
private WorkingBeatmap beatmap;
public override void Reset()
{
base.Reset();
if (beatmap == null)
{
var beatmapInfo = db.Query<BeatmapInfo>().FirstOrDefault(b => b.RulesetID == 0);
if (beatmapInfo != null)
beatmap = db.GetWorkingBeatmap(beatmapInfo);
}
base.Reset();
Add(new Results(new Score
{
TotalScore = 2845370,
Accuracy = 0.98,
MaxCombo = 123,
Rank = ScoreRank.A,
Date = DateTime.Now,
Statistics = new Dictionary<string, dynamic>()
{
{ "300", 50 },
{ "100", 20 },
{ "50", 50 },
{ "x", 1 }
},
User = new User
{
Username = "peppy",
}
})
{
Beatmap = beatmap
});
}
}
}
@@ -0,0 +1,92 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Configuration;
using OpenTK;
using osu.Game.Graphics;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseTooltip : TestCase
{
public override string Description => "tests tooltips on various elements";
public override void Reset()
{
base.Reset();
OsuSliderBar<int> slider;
OsuSliderBar<double> sliderDouble;
const float width = 400;
Children = new Drawable[]
{
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new TooltipTextContainer("text with a tooltip"),
new TooltipTextContainer("more text with another tooltip"),
new TooltipTextbox
{
Text = "a textbox with a tooltip",
Size = new Vector2(width,30),
},
slider = new OsuSliderBar<int>
{
Width = width,
},
sliderDouble = new OsuSliderBar<double>
{
Width = width,
},
},
},
};
slider.Current.BindTo(new BindableInt(5)
{
MaxValue = 10,
MinValue = 0
});
sliderDouble.Current.BindTo(new BindableDouble(0.5)
{
MaxValue = 1,
MinValue = 0
});
}
private class TooltipTextContainer : Container, IHasTooltip
{
private readonly OsuSpriteText text;
public string TooltipText => text.Text;
public TooltipTextContainer(string tooltipText)
{
AutoSizeAxes = Axes.Both;
Children = new[]
{
text = new OsuSpriteText
{
Text = tooltipText,
}
};
}
}
private class TooltipTextbox : OsuTextBox, IHasTooltip
{
public string TooltipText => Text;
}
}
}
@@ -198,12 +198,14 @@
<Compile Include="Tests\TestCaseKeyCounter.cs" />
<Compile Include="Tests\TestCaseMenuButtonSystem.cs" />
<Compile Include="Tests\TestCaseReplay.cs" />
<Compile Include="Tests\TestCaseResults.cs" />
<Compile Include="Tests\TestCaseScoreCounter.cs" />
<Compile Include="Tests\TestCaseTabControl.cs" />
<Compile Include="Tests\TestCaseTaikoHitObjects.cs" />
<Compile Include="Tests\TestCaseTaikoPlayfield.cs" />
<Compile Include="Tests\TestCaseTextAwesome.cs" />
<Compile Include="Tests\TestCasePlaySongSelect.cs" />
<Compile Include="Tests\TestCaseTooltip.cs" />
<Compile Include="Tests\TestCaseTwoLayerButton.cs" />
<Compile Include="VisualTestGame.cs" />
<Compile Include="Platform\TestStorage.cs" />
+8 -3
View File
@@ -12,6 +12,7 @@ using System.Diagnostics;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Replays;
using osu.Game.Users;
namespace osu.Game.Rulesets.Osu
{
@@ -27,6 +28,11 @@ namespace osu.Game.Rulesets.Osu
{
this.beatmap = beatmap;
User = new User
{
Username = @"Autoplay",
};
createAutoReplay();
}
@@ -132,8 +138,7 @@ namespace osu.Game.Rulesets.Osu
if (h is Spinner)
{
targetPosition.X = Frames[Frames.Count - 1].MouseX;
targetPosition.Y = Frames[Frames.Count - 1].MouseY;
targetPosition = Frames[Frames.Count - 1].Position;
Vector2 difference = spinner_centre - targetPosition;
@@ -187,7 +192,7 @@ namespace osu.Game.Rulesets.Osu
addFrameToReplay(lastFrame);
}
Vector2 lastPosition = new Vector2(lastFrame.MouseX, lastFrame.MouseY);
Vector2 lastPosition = lastFrame.Position;
double timeDifference = applyModsToTime(h.StartTime - lastFrame.Time);
-11
View File
@@ -1,11 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Scoring
{
internal class OsuScore : Score
{
}
}
@@ -1,9 +1,12 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Extensions;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
@@ -26,12 +29,34 @@ namespace osu.Game.Rulesets.Osu.Scoring
Health.Value = 1;
Accuracy.Value = 1;
scoreResultCounts.Clear();
comboResultCounts.Clear();
}
private readonly Dictionary<OsuScoreResult, int> scoreResultCounts = new Dictionary<OsuScoreResult, int>();
private readonly Dictionary<ComboResult, int> comboResultCounts = new Dictionary<ComboResult, int>();
public override void PopulateScore(Score score)
{
base.PopulateScore(score);
score.Statistics[@"300"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit300);
score.Statistics[@"100"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit100);
score.Statistics[@"50"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit50);
score.Statistics[@"x"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Miss);
}
protected override void OnNewJudgement(OsuJudgement judgement)
{
if (judgement != null)
{
if (judgement.Result != HitResult.None)
{
scoreResultCounts[judgement.Score] = scoreResultCounts.GetOrDefault(judgement.Score) + 1;
comboResultCounts[judgement.Combo] = comboResultCounts.GetOrDefault(judgement.Combo) + 1;
}
switch (judgement.Result)
{
case HitResult.Hit:
@@ -72,7 +72,6 @@
<Compile Include="OsuAutoReplay.cs" />
<Compile Include="OsuDifficultyCalculator.cs" />
<Compile Include="OsuKeyConversionInputManager.cs" />
<Compile Include="Scoring\OsuScore.cs" />
<Compile Include="Scoring\OsuScoreProcessor.cs" />
<Compile Include="UI\OsuHitRenderer.cs" />
<Compile Include="UI\OsuPlayfield.cs" />
@@ -98,11 +98,11 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
double osuDuration = distance / osuVelocity;
// If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat
double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats) / 8;
double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats);
if (tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength)
{
for (double j = obj.StartTime; j <= distanceData.EndTime + tickSpacing; j += tickSpacing)
for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing)
{
// Todo: This should generate different type of hits (including strongs)
// depending on hitobject sound additions (not implemented fully yet)
@@ -27,11 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
protected override void CheckJudgement(bool userTriggered)
{
if (!userTriggered)
{
if (Judgement.TimeOffset > HitObject.HitWindow)
Judgement.Result = HitResult.Miss;
return;
}
if (Math.Abs(Judgement.TimeOffset) < HitObject.HitWindow)
{
@@ -3,14 +3,13 @@
using System;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Taiko.UI;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
{
public class ElongatedCirclePiece : CirclePiece
{
/// <summary>
/// As we are being used to define the absolute size of hits, we need to be given a relative reference of our containing <see cref="TaikoPlayfield"/>.
/// As we are being used to define the absolute size of hits, we need to be given a relative reference of our containing playfield container.
/// </summary>
public Func<float> PlayfieldLengthReference;
@@ -38,4 +37,4 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
Width = (PlayfieldLengthReference?.Invoke() ?? 0) * Length + DrawHeight;
}
}
}
}
@@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
/// <summary>
/// The size of a tick.
/// </summary>
private const float tick_size = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 4;
private const float tick_size = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 6;
private bool filled;
public bool Filled
@@ -24,8 +24,8 @@ namespace osu.Game.Rulesets.Taiko.Replays
{
bool hitButton = true;
Frames.Add(new ReplayFrame(-100000, 320, 240, ReplayButtonState.None));
Frames.Add(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 320, 240, ReplayButtonState.None));
Frames.Add(new ReplayFrame(-100000, null, null, ReplayButtonState.None));
Frames.Add(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, null, null, ReplayButtonState.None));
for (int i = 0; i < beatmap.HitObjects.Count; i++)
{
@@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
break;
}
Frames.Add(new ReplayFrame(j, 0, 0, button));
Frames.Add(new ReplayFrame(j, null, null, button));
d = (d + 1) % 4;
if (++count > req)
break;
@@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
{
foreach (var tick in drumRoll.Ticks)
{
Frames.Add(new ReplayFrame(tick.StartTime, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
Frames.Add(new ReplayFrame(tick.StartTime, null, null, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
hitButton = !hitButton;
}
}
@@ -95,18 +95,18 @@ namespace osu.Game.Rulesets.Taiko.Replays
button = hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2;
}
Frames.Add(new ReplayFrame(h.StartTime, 0, 0, button));
Frames.Add(new ReplayFrame(h.StartTime, null, null, button));
}
else
throw new Exception("Unknown hit object type.");
Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, 0, 0, ReplayButtonState.None));
Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, null, null, ReplayButtonState.None));
if (i < beatmap.HitObjects.Count - 1)
{
double waitTime = beatmap.HitObjects[i + 1].StartTime - 1000;
if (waitTime > endTime)
Frames.Add(new ReplayFrame(waitTime, 0, 0, ReplayButtonState.None));
Frames.Add(new ReplayFrame(waitTime, null, null, ReplayButtonState.None));
}
hitButton = !hitButton;
+18 -1
View File
@@ -8,6 +8,7 @@ using osu.Game.Database;
using osu.Game.Rulesets.Mods;
using System;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Beatmaps
{
@@ -26,6 +27,18 @@ namespace osu.Game.Beatmaps
BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapSetInfo;
WithStoryboard = withStoryboard;
Mods.ValueChanged += mods => applyRateAdjustments();
}
private void applyRateAdjustments()
{
var t = track;
if (t == null) return;
t.ResetSpeedAdjustments();
foreach (var mod in Mods.Value.OfType<IApplicableToClock>())
mod.ApplyToClock(t);
}
protected abstract Beatmap GetBeatmap();
@@ -66,7 +79,11 @@ namespace osu.Game.Beatmaps
{
lock (trackLock)
{
return track ?? (track = GetTrack());
if (track != null) return track;
track = GetTrack();
applyRateAdjustments();
return track;
}
}
}
+3 -2
View File
@@ -38,6 +38,8 @@ namespace osu.Game.Configuration
Set(OsuConfig.KeyOverlay, false);
//todo: implement all settings below this line (remove the Disabled set when doing so).
Set(OsuConfig.AudioOffset, 0, -500.0, 500.0);
Set(OsuConfig.MouseSpeed, 1.0).Disabled = true;
Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; // TODO: use thi.Disabled = trues
Set(OsuConfig.AllowPublicInvites, true).Disabled = true;
@@ -103,7 +105,6 @@ namespace osu.Game.Configuration
Set(OsuConfig.ManiaSpeedBPMScale, true).Disabled = true;
Set(OsuConfig.MenuTip, 0).Disabled = true;
Set(OsuConfig.MouseSpeed, 1, 0.4, 6).Disabled = true;
Set(OsuConfig.Offset, 0, -300, 300).Disabled = true;
Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2).Disabled = true;
//Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2).Disabled = true;
Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6).Disabled = true;
@@ -270,7 +271,7 @@ namespace osu.Game.Configuration
MouseDisableButtons,
MouseDisableWheel,
MouseSpeed,
Offset,
AudioOffset,
ScoreMeterScale,
DistanceSpacing,
EditorBeatDivisor,
+37 -3
View File
@@ -2,11 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using osu.Framework.Platform;
using osu.Game.IO.Legacy;
using osu.Game.IPC;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring;
using SharpCompress.Compressors.LZMA;
using SQLite.Net;
@@ -42,8 +44,10 @@ namespace osu.Game.Database
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
using (SerializationReader sr = new SerializationReader(s))
{
var ruleset = rulesets.GetRuleset(sr.ReadByte()).CreateInstance();
score = ruleset.CreateScoreProcessor().CreateScore();
score = new Score
{
Ruleset = rulesets.GetRuleset(sr.ReadByte())
};
/* score.Pass = true;*/
var version = sr.ReadInt32();
@@ -104,13 +108,43 @@ namespace osu.Game.Database
using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize))
using (var reader = new StreamReader(lzma))
score.Replay = score.CreateReplay(reader);
score.Replay = createLegacyReplay(reader);
}
}
return score;
}
/// <summary>
/// Creates a legacy replay which is read from a stream.
/// </summary>
/// <param name="reader">The stream reader.</param>
/// <returns>The legacy replay.</returns>
private Replay createLegacyReplay(StreamReader reader)
{
var frames = new List<ReplayFrame>();
float lastTime = 0;
foreach (var l in reader.ReadToEnd().Split(','))
{
var split = l.Split('|');
if (split.Length < 4 || float.Parse(split[0]) < 0) continue;
lastTime += float.Parse(split[0]);
frames.Add(new ReplayFrame(
lastTime,
float.Parse(split[1]),
384 - float.Parse(split[2]),
(ReplayButtonState)int.Parse(split[3])
));
}
return new Replay { Frames = frames };
}
protected override void Prepare(bool reset = false)
{
}
+1 -1
View File
@@ -98,7 +98,7 @@ namespace osu.Game.Graphics.Cursor
public Cursor()
{
Size = new Vector2(42);
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
@@ -0,0 +1,158 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Framework.Threading;
using osu.Game.Graphics.Sprites;
using System.Linq;
namespace osu.Game.Graphics.Cursor
{
public class TooltipContainer : Container
{
private readonly CursorContainer cursor;
private readonly Tooltip tooltip;
private ScheduledDelegate findTooltipTask;
private UserInputManager inputManager;
private const int default_appear_delay = 220;
private IHasTooltip currentlyDisplayed;
public TooltipContainer(CursorContainer cursor)
{
this.cursor = cursor;
AlwaysPresent = true;
RelativeSizeAxes = Axes.Both;
Add(tooltip = new Tooltip { Alpha = 0 });
}
[BackgroundDependencyLoader]
private void load(UserInputManager input)
{
inputManager = input;
}
protected override void Update()
{
if (tooltip.IsPresent)
{
if (currentlyDisplayed != null)
tooltip.TooltipText = currentlyDisplayed.TooltipText;
//update the position of the displayed tooltip.
tooltip.Position = ToLocalSpace(cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre) + new Vector2(10);
}
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
updateTooltipState(state);
return base.OnMouseUp(state, args);
}
protected override bool OnMouseMove(InputState state)
{
updateTooltipState(state);
return base.OnMouseMove(state);
}
private void updateTooltipState(InputState state)
{
if (currentlyDisplayed?.Hovering != true)
{
if (currentlyDisplayed != null && !state.Mouse.HasMainButtonPressed)
{
tooltip.Delay(150);
tooltip.FadeOut(500, EasingTypes.OutQuint);
currentlyDisplayed = null;
}
findTooltipTask?.Cancel();
findTooltipTask = Scheduler.AddDelayed(delegate
{
var tooltipTarget = inputManager.HoveredDrawables.OfType<IHasTooltip>().FirstOrDefault();
if (tooltipTarget == null) return;
tooltip.TooltipText = tooltipTarget.TooltipText;
tooltip.FadeIn(500, EasingTypes.OutQuint);
currentlyDisplayed = tooltipTarget;
}, (1 - tooltip.Alpha) * default_appear_delay);
}
}
public class Tooltip : Container
{
private readonly Box background;
private readonly OsuSpriteText text;
public string TooltipText
{
set
{
if (value == text.Text) return;
text.Text = value;
if (Alpha > 0)
{
AutoSizeDuration = 250;
background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint);
}
else
AutoSizeDuration = 0;
}
}
public override bool HandleInput => false;
private const float text_size = 16;
public Tooltip()
{
AutoSizeEasing = EasingTypes.OutQuint;
AutoSizeAxes = Axes.Both;
CornerRadius = 5;
Masking = true;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(40),
Radius = 5,
};
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.9f,
},
text = new OsuSpriteText
{
TextSize = text_size,
Padding = new MarginPadding(5),
Font = @"Exo2.0-Regular",
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
background.Colour = colour.Gray3;
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
namespace osu.Game.Graphics
{
public interface IHasTooltip : IDrawable
{
/// <summary>
/// Tooltip that shows when hovering the drawable
/// </summary>
string TooltipText { get; }
}
}
+5 -1
View File
@@ -80,6 +80,10 @@ namespace osu.Game.Graphics
public Color4 GrayE = FromHex(@"eee");
public Color4 GrayF = FromHex(@"fff");
public Color4 Red = FromHex(@"fc4549");
public Color4 RedLighter = FromHex(@"ffeded");
public Color4 RedLight = FromHex(@"ed7787");
public Color4 Red = FromHex(@"ed1121");
public Color4 RedDark = FromHex(@"ba0011");
public Color4 RedDarker = FromHex(@"870000");
}
}
@@ -25,8 +25,6 @@ namespace osu.Game.Graphics.UserInterface
{
bindable = value;
Current.BindTo(bindable);
if (value?.Disabled ?? true)
Alpha = 0.3f;
}
}
@@ -84,6 +82,11 @@ namespace osu.Game.Graphics.UserInterface
else
sampleUnchecked?.Play();
};
Current.DisabledChanged += disabled =>
{
Alpha = disabled ? 0.3f : 1;
};
}
protected override bool OnHover(InputState state)
@@ -5,6 +5,7 @@ using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@@ -12,15 +13,36 @@ using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
public class OsuSliderBar<U> : SliderBar<U> where U : struct
public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip where T : struct
{
private SampleChannel sample;
private double lastSampleTime;
private T lastSampleValue;
private readonly Nub nub;
private readonly Box leftBox;
private readonly Box rightBox;
public string TooltipText
{
get
{
var bindableDouble = CurrentNumber as BindableNumber<double>;
if (bindableDouble != null)
{
if (bindableDouble.MaxValue == 1 && bindableDouble.MinValue == 0)
return bindableDouble.Value.ToString(@"P0");
return bindableDouble.Value.ToString(@"n1");
}
var bindableInt = CurrentNumber as BindableNumber<int>;
if (bindableInt != null)
return bindableInt.Value.ToString(@"n0");
return Current.Value.ToString();
}
}
public OsuSliderBar()
{
Height = 12;
@@ -52,6 +74,11 @@ namespace osu.Game.Graphics.UserInterface
Expanded = true,
}
};
Current.DisabledChanged += disabled =>
{
Alpha = disabled ? 0.3f : 1;
};
}
[BackgroundDependencyLoader]
@@ -84,6 +111,12 @@ namespace osu.Game.Graphics.UserInterface
{
if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50)
return;
if (Current.Value.Equals(lastSampleValue))
return;
lastSampleValue = Current.Value;
lastSampleTime = Clock.CurrentTime;
sample.Frequency.Value = 1 + NormalizedValue * 0.2f;
@@ -33,6 +33,11 @@ namespace osu.Game.Graphics.UserInterface
Height = 40;
TextContainer.Height = 0.5f;
CornerRadius = 5;
Current.DisabledChanged += disabled =>
{
Alpha = disabled ? 0.3f : 1;
};
}
[BackgroundDependencyLoader]
+1 -1
View File
@@ -86,7 +86,7 @@ namespace osu.Game.Online.Chat.Drawables
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = @"Exo2.0-SemiBold",
Text = $@"{Message.Timestamp.LocalDateTime:hh:mm:ss}",
Text = $@"{Message.Timestamp.LocalDateTime:HH:mm:ss}",
FixedWidth = true,
TextSize = text_size * 0.75f,
Alpha = 0.4f,
+1 -7
View File
@@ -203,13 +203,7 @@ namespace osu.Game
{
Depth = -3,
OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); },
OnRulesetChange = r => Ruleset.Value = r,
}, t =>
{
Ruleset.ValueChanged += delegate { Toolbar.SetRuleset(Ruleset.Value); };
Ruleset.TriggerChange();
overlayContent.Add(Toolbar);
});
}, overlayContent.Add);
options.StateChanged += delegate
{
+12 -2
View File
@@ -116,6 +116,7 @@ namespace osu.Game
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));
OszArchiveReader.Register();
@@ -144,9 +145,18 @@ namespace osu.Game
AddInternal(ratioContainer = new RatioAdjust
{
Children = new[]
Children = new Drawable[]
{
Cursor = new MenuCursor { Depth = float.MinValue }
new Container
{
RelativeSizeAxes = Axes.Both,
Depth = float.MinValue,
Children = new Drawable[]
{
Cursor = new MenuCursor(),
new TooltipContainer(Cursor) { Depth = -1 },
}
},
}
});
}
+5 -2
View File
@@ -34,8 +34,6 @@ namespace osu.Game.Overlays.Options
{
bindable = value;
dropdown.Current.BindTo(bindable);
if (value?.Disabled ?? true)
Alpha = 0.3f;
}
}
@@ -75,6 +73,11 @@ namespace osu.Game.Overlays.Options
Items = Items,
}
};
dropdown.Current.DisabledChanged += disabled =>
{
Alpha = disabled ? 0.3f : 1;
};
}
}
}
@@ -35,8 +35,6 @@ namespace osu.Game.Overlays.Options
{
bindable = value;
slider.Current.BindTo(bindable);
if (value?.Disabled ?? true)
Alpha = 0.3f;
}
}
+1 -3
View File
@@ -16,9 +16,7 @@ namespace osu.Game.Overlays.Options
{
bindable = value;
Current.BindTo(bindable);
if (value?.Disabled ?? true)
Alpha = 0.3f;
}
}
}
}
}
@@ -18,10 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio
{
Children = new Drawable[]
{
new OptionSlider<int>
new OptionSlider<double>
{
LabelText = "Universal Offset",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.Offset)
LabelText = "Audio Offset",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.AudioOffset)
},
new OsuButton
{
+1 -12
View File
@@ -8,7 +8,6 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Database;
using osu.Game.Graphics;
using OpenTK;
@@ -20,9 +19,7 @@ namespace osu.Game.Overlays.Toolbar
public const float TOOLTIP_HEIGHT = 30;
public Action OnHome;
public Action<RulesetInfo> OnRulesetChange;
private readonly ToolbarModeSelector modeSelector;
private readonly ToolbarUserArea userArea;
protected override bool HideOnEscape => false;
@@ -53,13 +50,7 @@ namespace osu.Game.Overlays.Toolbar
{
Action = () => OnHome?.Invoke()
},
modeSelector = new ToolbarModeSelector
{
OnRulesetChange = mode =>
{
OnRulesetChange?.Invoke(mode);
}
}
new ToolbarModeSelector()
}
},
new FillFlowContainer
@@ -130,8 +121,6 @@ namespace osu.Game.Overlays.Toolbar
}
}
public void SetRuleset(RulesetInfo ruleset) => modeSelector.SetRuleset(ruleset);
protected override void PopIn()
{
MoveToY(0, transition_time, EasingTypes.OutQuint);
@@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Caching;
@@ -12,6 +11,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
namespace osu.Game.Overlays.Toolbar
{
@@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Toolbar
private readonly Drawable modeButtonLine;
private ToolbarModeButton activeButton;
public Action<RulesetInfo> OnRulesetChange;
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
public ToolbarModeSelector()
{
@@ -66,30 +66,36 @@ namespace osu.Game.Overlays.Toolbar
}
[BackgroundDependencyLoader]
private void load(RulesetDatabase rulesets)
private void load(RulesetDatabase rulesets, OsuGame game)
{
foreach (var ruleset in rulesets.AllRulesets)
foreach (var r in rulesets.AllRulesets)
{
modeButtons.Add(new ToolbarModeButton
{
Ruleset = ruleset,
Ruleset = r,
Action = delegate
{
SetRuleset(ruleset);
OnRulesetChange?.Invoke(ruleset);
ruleset.Value = r;
}
});
}
ruleset.ValueChanged += rulesetChanged;
ruleset.DisabledChanged += disabledChanged;
ruleset.BindTo(game.Ruleset);
}
public override bool HandleInput => !ruleset.Disabled;
private void disabledChanged(bool isDisabled) => FadeColour(isDisabled ? Color4.Gray : Color4.White, 300);
protected override void Update()
{
base.Update();
Size = new Vector2(modeButtons.DrawSize.X, 1);
}
public void SetRuleset(RulesetInfo ruleset)
private void rulesetChanged(RulesetInfo ruleset)
{
foreach (ToolbarModeButton m in modeButtons.Children.Cast<ToolbarModeButton>())
{
@@ -1,22 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Judgements
{
/// <summary>
/// Inidicates that the judgement this is attached to is a partial judgement and the scoring value may change.
/// <para>
/// This judgement will be continually processed by <see cref="DrawableHitObject{TObject, TJudgement}.CheckJudgement(bool)"/>
/// unless the result is a miss and will trigger a full re-process of the <see cref="ScoreProcessor"/> when changed.
/// </para>
/// </summary>
public interface IPartialJudgement
{
/// <summary>
/// Indicates that this partial judgement has changed and requires a full re-process of the <see cref="ScoreProcessor"/>.
/// Indicates that this partial judgement has changed and requires reprocessing.
/// <para>
/// This is set to false once the judgement has been re-processed.
/// </para>
+1 -1
View File
@@ -17,6 +17,6 @@ namespace osu.Game.Rulesets.Mods
/// Applies the mod to a HitRenderer.
/// </summary>
/// <param name="hitRenderer">The HitRenderer to apply the mod to.</param>
void Apply(HitRenderer<TObject> hitRenderer);
void ApplyToHitRenderer(HitRenderer<TObject> hitRenderer);
}
}
@@ -0,0 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Timing;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// An interface for mods that make adjustments to the track.
/// </summary>
public interface IApplicableToClock
{
void ApplyToClock(IAdjustableClock clock);
}
}
-131
View File
@@ -1,12 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
using System;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
@@ -45,131 +41,4 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
public virtual Type[] IncompatibleMods => new Type[] { };
}
public class MultiMod : Mod
{
public override string Name => string.Empty;
public override string Description => string.Empty;
public override double ScoreMultiplier => 0.0;
public Mod[] Mods;
}
public abstract class ModNoFail : Mod
{
public override string Name => "NoFail";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
public override string Description => "You can't fail, no matter what.";
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) };
}
public abstract class ModEasy : Mod
{
public override string Name => "Easy";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
}
public abstract class ModHidden : Mod
{
public override string Name => "Hidden";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
public override bool Ranked => true;
}
public abstract class ModHardRock : Mod
{
public override string Name => "Hard Rock";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
public override string Description => "Everything just got a bit harder...";
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
}
public abstract class ModSuddenDeath : Mod
{
public override string Name => "Sudden Death";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
public override string Description => "Miss a note and fail.";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
}
public abstract class ModDoubleTime : Mod
{
public override string Name => "Double Time";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
public override string Description => "Zoooooooooom";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
}
public abstract class ModRelax : Mod
{
public override string Name => "Relax";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) };
}
public abstract class ModHalfTime : Mod
{
public override string Name => "Half Time";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
public override string Description => "Less zoom";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
}
public abstract class ModNightcore : ModDoubleTime
{
public override string Name => "Nightcore";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore;
public override string Description => "uguuuuuuuu";
}
public abstract class ModFlashlight : Mod
{
public override string Name => "Flashlight";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
public override string Description => "Restricted view area.";
public override bool Ranked => true;
}
public class ModAutoplay : Mod
{
public override string Name => "Autoplay";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
public override string Description => "Watch a perfect automated play through the song";
public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
}
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableMod<T>
where T : HitObject
{
protected abstract Score CreateReplayScore(Beatmap<T> beatmap);
public void Apply(HitRenderer<T> hitRenderer)
{
hitRenderer.SetReplay(CreateReplayScore(hitRenderer.Beatmap)?.Replay);
}
}
public abstract class ModPerfect : ModSuddenDeath
{
public override string Name => "Perfect";
public override string Description => "SS or quit.";
}
public class ModCinema : ModAutoplay
{
public override string Name => "Cinema";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema;
}
}
+32
View File
@@ -0,0 +1,32 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableMod<T>
where T : HitObject
{
protected abstract Score CreateReplayScore(Beatmap<T> beatmap);
public void ApplyToHitRenderer(HitRenderer<T> hitRenderer)
{
hitRenderer.SetReplay(CreateReplayScore(hitRenderer.Beatmap)?.Replay);
}
}
public class ModAutoplay : Mod
{
public override string Name => "Autoplay";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
public override string Description => "Watch a perfect automated play through the song";
public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
}
}
+13
View File
@@ -0,0 +1,13 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public class ModCinema : ModAutoplay
{
public override string Name => "Cinema";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema;
}
}
+25
View File
@@ -0,0 +1,25 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Timing;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public class ModDoubleTime : Mod, IApplicableToClock
{
public override string Name => "Double Time";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
public override string Description => "Zoooooooooom";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
public override double ScoreMultiplier => 1.12;
public virtual void ApplyToClock(IAdjustableClock clock)
{
clock.Rate = 1.5;
}
}
}
+18
View File
@@ -0,0 +1,18 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModEasy : Mod
{
public override string Name => "Easy";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
}
}
+15
View File
@@ -0,0 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModFlashlight : Mod
{
public override string Name => "Flashlight";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
public override string Description => "Restricted view area.";
public override bool Ranked => true;
}
}
+25
View File
@@ -0,0 +1,25 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Timing;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModHalfTime : Mod, IApplicableToClock
{
public override string Name => "Half Time";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
public override string Description => "Less zoom";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
public override double ScoreMultiplier => 1.12;
public void ApplyToClock(IAdjustableClock clock)
{
clock.Rate = 0.75;
}
}
}
+16
View File
@@ -0,0 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModHardRock : Mod
{
public override string Name => "Hard Rock";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
public override string Description => "Everything just got a bit harder...";
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
}
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModHidden : Mod
{
public override string Name => "Hidden";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
public override bool Ranked => true;
}
}
+25
View File
@@ -0,0 +1,25 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Audio;
using osu.Framework.Timing;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModNightcore : ModDoubleTime
{
public override string Name => "Nightcore";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore;
public override string Description => "uguuuuuuuu";
public override void ApplyToClock(IAdjustableClock clock)
{
var pitchAdjust = clock as IHasPitchAdjust;
if (pitchAdjust != null)
pitchAdjust.PitchAdjust = 1.5;
else
base.ApplyToClock(clock);
}
}
}
+18
View File
@@ -0,0 +1,18 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModNoFail : Mod
{
public override string Name => "NoFail";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
public override string Description => "You can't fail, no matter what.";
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) };
}
}
+11
View File
@@ -0,0 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Mods
{
public abstract class ModPerfect : ModSuddenDeath
{
public override string Name => "Perfect";
public override string Description => "SS or quit.";
}
}
+16
View File
@@ -0,0 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModRelax : Mod
{
public override string Name => "Relax";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) };
}
}
+18
View File
@@ -0,0 +1,18 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModSuddenDeath : Mod
{
public override string Name => "Sudden Death";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
public override string Description => "Miss a note and fail.";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
}
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Mods
{
public class MultiMod : Mod
{
public override string Name => string.Empty;
public override string Description => string.Empty;
public override double ScoreMultiplier => 0.0;
public Mod[] Mods;
}
}
+3
View File
@@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Users;
namespace osu.Game.Rulesets.Replays
{
@@ -9,6 +10,8 @@ namespace osu.Game.Rulesets.Replays
{
protected const double KEY_UP_DELAY = 50;
public User User;
public List<ReplayFrame> Frames = new List<ReplayFrame>();
}
}
+7 -7
View File
@@ -7,12 +7,12 @@ namespace osu.Game.Rulesets.Replays
{
public class ReplayFrame
{
public Vector2 Position => new Vector2(MouseX, MouseY);
public Vector2 Position => new Vector2(MouseX ?? 0, MouseY ?? 0);
public bool IsImportant => MouseLeft || MouseRight;
public bool IsImportant => MouseX.HasValue && MouseY.HasValue && (MouseLeft || MouseRight);
public float MouseX;
public float MouseY;
public float? MouseX;
public float? MouseY;
public bool MouseLeft => MouseLeft1 || MouseLeft2;
public bool MouseRight => MouseRight1 || MouseRight2;
@@ -55,10 +55,10 @@ namespace osu.Game.Rulesets.Replays
}
public ReplayFrame(double time, float posX, float posY, ReplayButtonState buttonState)
public ReplayFrame(double time, float? mouseX, float? mouseY, ReplayButtonState buttonState)
{
MouseX = posX;
MouseY = posY;
MouseX = mouseX;
MouseY = mouseY;
ButtonState = buttonState;
Time = time;
}
+6
View File
@@ -17,6 +17,12 @@ namespace osu.Game.Rulesets
public abstract IEnumerable<Mod> GetModsFor(ModType type);
/// <summary>
/// Attempt to create a HitRenderer for the provided beatmap.
/// </summary>
/// <param name="beatmap"></param>
/// <exception cref="BeatmapInvalidForRulesetException">Unable to successfully load the beatmap to be usable with this ruleset.</exception>
/// <returns></returns>
public abstract HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap);
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);
+29 -44
View File
@@ -7,25 +7,22 @@ using Newtonsoft.Json;
using osu.Game.Database;
using osu.Game.Rulesets.Mods;
using osu.Game.Users;
using System.IO;
using osu.Game.Rulesets.Replays;
namespace osu.Game.Rulesets.Scoring
{
public class Score
{
[JsonProperty(@"rank")]
public ScoreRank Rank { get; set; }
[JsonProperty(@"score")]
public double TotalScore { get; set; }
[JsonProperty(@"accuracy")]
public double Accuracy { get; set; }
public double Health { get; set; } = 1;
[JsonProperty(@"combo")]
[JsonProperty(@"max_combo")]
public int MaxCombo { get; set; }
public int Combo { get; set; }
@@ -33,6 +30,8 @@ namespace osu.Game.Rulesets.Scoring
[JsonProperty(@"mods")]
protected string[] ModStrings { get; set; } //todo: parse to Mod objects
public RulesetInfo Ruleset { get; set; }
public Mod[] Mods { get; set; }
[JsonProperty(@"user")]
@@ -49,51 +48,37 @@ namespace osu.Game.Rulesets.Scoring
[JsonProperty(@"created_at")]
public DateTime Date;
/// <summary>
/// Creates a replay which is read from a stream.
/// </summary>
/// <param name="reader">The stream reader.</param>
/// <returns>The replay.</returns>
public virtual Replay CreateReplay(StreamReader reader)
[JsonProperty(@"statistics")]
private Dictionary<string, dynamic> jsonStats
{
var frames = new List<ReplayFrame>();
float lastTime = 0;
foreach (var l in reader.ReadToEnd().Split(','))
set
{
var split = l.Split('|');
foreach (var kvp in value)
{
string key = kvp.Key;
switch (key)
{
case @"count_300":
key = @"300";
break;
case @"count_100":
key = @"100";
break;
case @"count_50":
key = @"50";
break;
case @"count_miss":
key = @"x";
break;
default:
continue;
}
if (split.Length < 4 || float.Parse(split[0]) < 0) continue;
lastTime += float.Parse(split[0]);
frames.Add(new ReplayFrame(
lastTime,
float.Parse(split[1]),
384 - float.Parse(split[2]),
(ReplayButtonState)int.Parse(split[3])
));
Statistics.Add(key, kvp.Value);
}
}
return new Replay { Frames = frames };
}
// [JsonProperty(@"count50")] 0,
//[JsonProperty(@"count100")] 0,
//[JsonProperty(@"count300")] 100,
//[JsonProperty(@"countmiss")] 0,
//[JsonProperty(@"countkatu")] 0,
//[JsonProperty(@"countgeki")] 31,
//[JsonProperty(@"perfect")] true,
//[JsonProperty(@"enabled_mods")] [
// "DT",
// "FL",
// "HD",
// "HR"
//],
//[JsonProperty(@"rank")] "XH",
//[JsonProperty(@"pp")] 26.1816,
//[JsonProperty(@"replay")] true
public Dictionary<string, dynamic> Statistics = new Dictionary<string, dynamic>();
}
}
+43 -11
View File
@@ -19,6 +19,11 @@ namespace osu.Game.Rulesets.Scoring
/// </summary>
public event Action Failed;
/// <summary>
/// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the <see cref="ScoreProcessor"/>.
/// </summary>
public event Action<Judgement> NewJudgement;
/// <summary>
/// The current total score.
/// </summary>
@@ -61,18 +66,20 @@ namespace osu.Game.Rulesets.Scoring
Reset();
}
/// <summary>
/// Creates a Score applicable to the ruleset in which this ScoreProcessor resides.
/// </summary>
/// <returns>The Score.</returns>
public virtual Score CreateScore() => new Score
private ScoreRank rankFrom(double acc)
{
TotalScore = TotalScore,
Combo = Combo,
MaxCombo = HighestCombo,
Accuracy = Accuracy,
Health = Health,
};
if (acc == 1)
return ScoreRank.X;
if (acc > 0.95)
return ScoreRank.S;
if (acc > 0.9)
return ScoreRank.A;
if (acc > 0.8)
return ScoreRank.B;
if (acc > 0.7)
return ScoreRank.C;
return ScoreRank.D;
}
/// <summary>
/// Resets this ScoreProcessor to a default state.
@@ -102,6 +109,29 @@ namespace osu.Game.Rulesets.Scoring
alreadyFailed = true;
Failed?.Invoke();
}
/// <summary>
/// Notifies subscribers of <see cref="NewJudgement"/> that a new judgement has occurred.
/// </summary>
/// <param name="judgement">The judgement to notify subscribers of.</param>
protected void NotifyNewJudgement(Judgement judgement)
{
NewJudgement?.Invoke(judgement);
}
/// <summary>
/// Retrieve a score populated with data for the current play this processor is responsible for.
/// </summary>
public virtual void PopulateScore(Score score)
{
score.TotalScore = TotalScore;
score.Combo = Combo;
score.MaxCombo = HighestCombo;
score.Accuracy = Accuracy;
score.Rank = rankFrom(Accuracy);
score.Date = DateTime.Now;
score.Health = Health;
}
}
public abstract class ScoreProcessor<TObject, TJudgement> : ScoreProcessor
@@ -161,6 +191,8 @@ namespace osu.Game.Rulesets.Scoring
Judgements.Add(judgement);
OnNewJudgement(judgement);
NotifyNewJudgement(judgement);
}
else
OnJudgementChanged(judgement);
+11 -5
View File
@@ -91,11 +91,17 @@ namespace osu.Game.Rulesets.UI
protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay);
public Replay Replay { get; private set; }
/// <summary>
/// Sets a replay to be used, overriding local input.
/// </summary>
/// <param name="replay">The replay, null for local input.</param>
public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
public void SetReplay(Replay replay)
{
Replay = replay;
InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
}
}
/// <summary>
@@ -125,7 +131,7 @@ namespace osu.Game.Rulesets.UI
// Check if the beatmap can be converted
if (!converter.CanConvert(beatmap.Beatmap))
throw new BeatmapInvalidForModeException($"{nameof(Beatmap)} can't be converted for the current ruleset.");
throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can't be converted for the current ruleset.");
// Convert the beatmap
Beatmap = converter.Convert(beatmap.Beatmap);
@@ -151,7 +157,7 @@ namespace osu.Game.Rulesets.UI
return;
foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
mod.Apply(this);
mod.ApplyToHitRenderer(this);
}
/// <summary>
@@ -273,9 +279,9 @@ namespace osu.Game.Rulesets.UI
protected abstract Playfield<TObject, TJudgement> CreatePlayfield();
}
public class BeatmapInvalidForModeException : Exception
public class BeatmapInvalidForRulesetException : Exception
{
public BeatmapInvalidForModeException(string text)
public BeatmapInvalidForRulesetException(string text)
: base(text)
{
}
+2 -2
View File
@@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.UI
}
}
public void BindProcessor(ScoreProcessor processor)
public virtual void BindProcessor(ScoreProcessor processor)
{
ScoreCounter?.Current.BindTo(processor.TotalScore);
AccuracyCounter?.Current.BindTo(processor.Accuracy);
@@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.UI
HealthDisplay?.Current.BindTo(processor.Health);
}
public void BindHitRenderer(HitRenderer hitRenderer)
public virtual void BindHitRenderer(HitRenderer hitRenderer)
{
hitRenderer.InputManager.Add(KeyCounter.GetReceptor());
}
+42 -4
View File
@@ -3,15 +3,42 @@
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using System;
namespace osu.Game.Rulesets.UI
{
public class StandardHealthDisplay : HealthDisplay, IHasAccentColour
{
/// <summary>
/// The base opacity of the glow.
/// </summary>
private const float base_glow_opacity = 0.6f;
/// <summary>
/// The number of sequential hits required within <see cref="glow_fade_delay"/> to reach the maximum glow opacity.
/// </summary>
private const int glow_max_hits = 8;
/// <summary>
/// The amount of time to delay before fading the glow opacity back to <see cref="base_glow_opacity"/>.
/// <para>
/// This is calculated to require a stream snapped to 1/4 at 150bpm to reach the maximum glow opacity with <see cref="glow_max_hits"/> hits.
/// </para>
/// </summary>
private const float glow_fade_delay = 100;
/// <summary>
/// The amount of time to fade the glow to <see cref="base_glow_opacity"/> after <see cref="glow_fade_delay"/>.
/// </summary>
private const double glow_fade_time = 500;
private readonly Container fill;
public Color4 AccentColour
@@ -32,9 +59,10 @@ namespace osu.Game.Rulesets.UI
fill.EdgeEffect = new EdgeEffect
{
Colour = glowColour,
Colour = glowColour.Opacity(base_glow_opacity),
Radius = 8,
Type = EdgeEffectType.Glow
Roundness = 4,
Type = EdgeEffectType.Glow,
};
}
}
@@ -51,7 +79,7 @@ namespace osu.Game.Rulesets.UI
fill = new Container
{
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0, 1),
Size = new Vector2(0, 1),
Masking = true,
Children = new[]
{
@@ -64,6 +92,16 @@ namespace osu.Game.Rulesets.UI
};
}
protected override void SetHealth(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
public void Flash(Judgement judgement)
{
if (judgement.Result == HitResult.Miss)
return;
fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint);
fill.Delay(glow_fade_delay);
fill.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint);
}
protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
}
}
+11 -2
View File
@@ -3,11 +3,11 @@
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Rulesets.UI
@@ -75,8 +75,17 @@ namespace osu.Game.Rulesets.UI
if (shd != null)
{
shd.AccentColour = colours.BlueLighter;
shd.GlowColour = colours.BlueDarker.Opacity(0.6f);
shd.GlowColour = colours.BlueDarker;
}
}
public override void BindProcessor(ScoreProcessor processor)
{
base.BindProcessor(processor);
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
processor.NewJudgement += shd.Flash;
}
}
}
+18 -1
View File
@@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens
@@ -25,8 +26,12 @@ namespace osu.Game.Screens
internal virtual bool HasLocalCursorDisplayed => false;
internal virtual bool AllowRulesetChange => true;
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
public WorkingBeatmap Beatmap
{
get
@@ -40,7 +45,7 @@ namespace osu.Game.Screens
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuGameBase game)
private void load(OsuGameBase game, OsuGame osuGame)
{
if (game != null)
{
@@ -52,11 +57,23 @@ namespace osu.Game.Screens
}
beatmap.ValueChanged += OnBeatmapChanged;
if (osuGame != null)
ruleset.BindTo(osuGame.Ruleset);
}
/// <summary>
/// The global Beatmap was changed.
/// </summary>
protected virtual void OnBeatmapChanged(WorkingBeatmap beatmap)
{
}
protected override void Update()
{
if (!IsCurrentScreen) return;
ruleset.Disabled = !AllowRulesetChange;
}
protected override void OnEntering(Screen last)
+43 -16
View File
@@ -17,11 +17,12 @@ using osu.Game.Database;
using osu.Game.Rulesets;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Ranking;
using System;
using System.Linq;
using osu.Framework.Threading;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking;
namespace osu.Game.Screens.Play
{
@@ -39,6 +40,8 @@ namespace osu.Game.Screens.Play
public bool IsPaused => !interpolatedSourceClock.IsRunning;
internal override bool AllowRulesetChange => false;
public bool HasFailed { get; private set; }
public int RestartCount;
@@ -49,13 +52,22 @@ namespace osu.Game.Screens.Play
private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown;
private IAdjustableClock sourceClock;
private OffsetClock offsetClock;
private IFrameBasedClock interpolatedSourceClock;
private Ruleset ruleset;
private RulesetInfo ruleset;
private ScoreProcessor scoreProcessor;
protected HitRenderer HitRenderer;
#region User Settings
private Bindable<int> dimLevel;
private Bindable<bool> mouseWheelDisabled;
private Bindable<double> userAudioOffset;
#endregion
private SkipButton skipButton;
private HudOverlay hudOverlay;
@@ -68,6 +80,8 @@ namespace osu.Game.Screens.Play
dimLevel = config.GetBindable<int>(OsuConfig.DimLevel);
mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel);
Ruleset rulesetInstance;
try
{
if (Beatmap == null)
@@ -79,17 +93,20 @@ namespace osu.Game.Screens.Play
if (Beatmap == null)
throw new Exception("Beatmap was not loaded");
ruleset = osu?.Ruleset.Value ?? Beatmap.BeatmapInfo.Ruleset;
rulesetInstance = ruleset.CreateInstance();
try
{
// Try using the preferred user ruleset
ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset.CreateInstance() : osu.Ruleset.Value.CreateInstance();
HitRenderer = ruleset.CreateHitRendererWith(Beatmap);
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap);
}
catch (BeatmapInvalidForModeException)
catch (BeatmapInvalidForRulesetException)
{
// Default to the beatmap ruleset
ruleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance();
HitRenderer = ruleset.CreateHitRendererWith(Beatmap);
// we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset
// let's try again forcing the beatmap's ruleset.
ruleset = Beatmap.BeatmapInfo.Ruleset;
rulesetInstance = ruleset.CreateInstance();
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap);
}
}
catch (Exception e)
@@ -110,11 +127,19 @@ namespace osu.Game.Screens.Play
}
sourceClock = (IAdjustableClock)track ?? new StopwatchClock();
interpolatedSourceClock = new InterpolatingFramedClock(sourceClock);
offsetClock = new OffsetClock(sourceClock);
userAudioOffset = config.GetBindable<double>(OsuConfig.AudioOffset);
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
userAudioOffset.TriggerChange();
interpolatedSourceClock = new InterpolatingFramedClock(offsetClock);
Schedule(() =>
{
sourceClock.Reset();
foreach (var mod in Beatmap.Mods.Value.OfType<IApplicableToClock>())
mod.ApplyToClock(sourceClock);
});
scoreProcessor = HitRenderer.CreateScoreProcessor();
@@ -125,7 +150,7 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre
};
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
hudOverlay.KeyCounter.Add(rulesetInstance.CreateGameplayKeys());
hudOverlay.BindProcessor(scoreProcessor);
hudOverlay.BindHitRenderer(HitRenderer);
@@ -266,10 +291,14 @@ namespace osu.Game.Screens.Play
Delay(1000);
onCompletionEvent = Schedule(delegate
{
Push(new Results
var score = new Score
{
Score = scoreProcessor.CreateScore()
});
Beatmap = Beatmap.BeatmapInfo,
Ruleset = ruleset
};
scoreProcessor.PopulateScore(score);
score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value;
Push(new Results(score));
});
}
@@ -351,8 +380,6 @@ namespace osu.Game.Screens.Play
Background?.FadeTo(1f, fade_out_duration);
}
private Bindable<bool> mouseWheelDisabled;
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused;
}
}
+2
View File
@@ -27,6 +27,8 @@ namespace osu.Game.Screens.Play
private bool showOverlays = true;
internal override bool ShowOverlays => showOverlays;
internal override bool AllowRulesetChange => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
public PlayerLoader(Player player)
@@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Ranking
{
public class AspectContainer : Container
{
protected override void Update()
{
base.Update();
if (RelativeSizeAxes == Axes.X)
Height = DrawWidth;
else
Width = DrawHeight;
}
}
}
+12
View File
@@ -0,0 +1,12 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Screens.Ranking
{
public enum ResultMode
{
Summary,
Ranking,
Share
}
}
@@ -0,0 +1,108 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Ranking
{
public class ResultModeButton : TabItem<ResultMode>
{
private readonly FontAwesome icon;
private Color4 activeColour;
private Color4 inactiveColour;
private CircularContainer colouredPart;
public ResultModeButton(ResultMode mode) : base(mode)
{
switch (mode)
{
case ResultMode.Summary:
icon = FontAwesome.fa_asterisk;
break;
case ResultMode.Ranking:
icon = FontAwesome.fa_list;
break;
case ResultMode.Share:
icon = FontAwesome.fa_camera;
break;
}
}
public override bool Active
{
get
{
return base.Active;
}
set
{
base.Active = value;
colouredPart.FadeColour(Active ? activeColour : inactiveColour, 200, EasingTypes.OutQuint);
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Size = new Vector2(50);
Masking = true;
CornerRadius = 25;
activeColour = colours.PinkDarker;
inactiveColour = OsuColour.Gray(0.8f);
EdgeEffect = new EdgeEffect
{
Colour = Color4.Black.Opacity(0.4f),
Type = EdgeEffectType.Shadow,
Radius = 5,
};
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
colouredPart = new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.8f),
BorderThickness = 4,
BorderColour = Color4.White,
Colour = inactiveColour,
Children = new Drawable[]
{
new Box
{
AlwaysPresent = true, //for border rendering
RelativeSizeAxes = Axes.Both,
Colour = Color4.Transparent,
},
new TextAwesome
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shadow = false,
Colour = OsuColour.Gray(0.95f),
Icon = icon,
TextSize = 20,
}
}
}
};
}
}
}
@@ -0,0 +1,31 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
using OpenTK;
namespace osu.Game.Screens.Ranking
{
public class ResultModeTabControl : TabControl<ResultMode>
{
public ResultModeTabControl()
{
TabContainer.Anchor = Anchor.BottomCentre;
TabContainer.Origin = Anchor.BottomCentre;
TabContainer.Spacing = new Vector2(15);
TabContainer.Masking = false;
TabContainer.Padding = new MarginPadding(5);
}
protected override Dropdown<ResultMode> CreateDropdown() => null;
protected override TabItem<ResultMode> CreateTabItem(ResultMode value) => new ResultModeButton(value)
{
Anchor = TabContainer.Anchor,
Origin = TabContainer.Origin
};
}
}
+239 -49
View File
@@ -1,93 +1,283 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Screens;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Scoring;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Ranking
{
internal class Results : OsuScreen
public class Results : OsuScreen
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
private readonly Score score;
private Container circleOuterBackground;
private Container circleOuter;
private Container circleInner;
private ParallaxContainer backgroundParallax;
private ResultModeTabControl modeChangeButtons;
internal override bool AllowRulesetChange => false;
private Container currentPage;
private static readonly Vector2 background_blur = new Vector2(20);
private ScoreDisplay scoreDisplay;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
private const float overscan = 1.3f;
private const float circle_outer_scale = 0.96f;
public Results(Score score)
{
this.score = score;
}
private const float transition_time = 800;
private IEnumerable<Drawable> allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter };
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
Background.Schedule(() => (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 1000));
(Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, EasingTypes.OutQuint);
allCircles.ForEach(c =>
{
c.FadeOut();
c.ScaleTo(0);
});
backgroundParallax.FadeOut();
modeChangeButtons.FadeOut();
currentPage.FadeOut();
circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint);
circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint);
Content.Delay(transition_time * 0.25f, true);
circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint);
circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint);
Content.Delay(transition_time * 0.3f, true);
backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint);
circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint);
circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint);
Content.Delay(transition_time * 0.4f, true);
modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint);
currentPage.FadeIn(transition_time, EasingTypes.OutQuint);
Content.DelayReset();
}
protected override bool OnExiting(Screen next)
{
Background.Schedule(() => Background.FadeColour(Color4.White, 500));
allCircles.ForEach(c =>
{
c.ScaleTo(0, transition_time, EasingTypes.OutSine);
});
Content.FadeOut(transition_time / 4);
return base.OnExiting(next);
}
public Score Score
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
set
{
scoreDisplay?.FadeOut(500);
scoreDisplay?.Expire();
scoreDisplay = new ScoreDisplay(value)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
Add(scoreDisplay);
scoreDisplay.FadeIn(500);
scoreDisplay.ScaleTo(0.1f);
scoreDisplay.ScaleTo(1, 1000, EasingTypes.OutElastic);
scoreDisplay.RotateTo(360 * 5, 1000, EasingTypes.OutElastic);
}
}
}
internal class ScoreDisplay : Container
{
public ScoreDisplay(Score s)
{
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
new FillFlowContainer
new AspectContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.Y,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Height = overscan,
Children = new Drawable[]
{
new OsuSpriteText
circleOuterBackground = new CircularContainer
{
TextSize = 40,
Text = $@"Accuracy: {s.Accuracy:#0.00%}",
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Masking = true,
Children = new Drawable[]
{
new Box
{
Alpha = 0.2f,
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
}
}
},
new OsuSpriteText
circleOuter = new CircularContainer
{
TextSize = 40,
Text = $@"Score: {s.TotalScore}",
Size = new Vector2(circle_outer_scale),
EdgeEffect = new EdgeEffect
{
Colour = Color4.Black.Opacity(0.4f),
Type = EdgeEffectType.Shadow,
Radius = 15,
},
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Masking = true,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
backgroundParallax = new ParallaxContainer
{
RelativeSizeAxes = Axes.Both,
ParallaxAmount = 0.01f,
Scale = new Vector2(1 / circle_outer_scale / overscan),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new Sprite
{
Alpha = 0.2f,
Texture = Beatmap?.Background,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill
}
}
},
modeChangeButtons = new ResultModeTabControl
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Height = 50,
Margin = new MarginPadding { Bottom = 110 },
},
new SpriteText
{
Text = $"{score.MaxCombo}x",
TextSize = 40,
RelativePositionAxes = Axes.X,
Font = @"Exo2.0-Bold",
X = 0.1f,
Colour = colours.BlueDarker,
Anchor = Anchor.CentreLeft,
Origin = Anchor.BottomCentre,
},
new SpriteText
{
Text = "max combo",
TextSize = 20,
RelativePositionAxes = Axes.X,
X = 0.1f,
Colour = colours.Gray6,
Anchor = Anchor.CentreLeft,
Origin = Anchor.TopCentre,
},
new SpriteText
{
Text = $"{score.Accuracy:P2}",
TextSize = 40,
RelativePositionAxes = Axes.X,
Font = @"Exo2.0-Bold",
X = 0.9f,
Colour = colours.BlueDarker,
Anchor = Anchor.CentreLeft,
Origin = Anchor.BottomCentre,
},
new SpriteText
{
Text = "accuracy",
TextSize = 20,
RelativePositionAxes = Axes.X,
X = 0.9f,
Colour = colours.Gray6,
Anchor = Anchor.CentreLeft,
Origin = Anchor.TopCentre,
},
}
},
new OsuSpriteText
circleInner = new CircularContainer
{
TextSize = 40,
Text = $@"MaxCombo: {s.MaxCombo}",
Size = new Vector2(0.6f),
EdgeEffect = new EdgeEffect
{
Colour = Color4.Black.Opacity(0.4f),
Type = EdgeEffectType.Shadow,
Radius = 15,
},
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Masking = true,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
}
}
}
}
},
new BackButton
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Action = Exit
},
};
modeChangeButtons.AddItem(ResultMode.Summary);
modeChangeButtons.AddItem(ResultMode.Ranking);
//modeChangeButtons.AddItem(ResultMode.Share);
modeChangeButtons.Current.ValueChanged += mode =>
{
currentPage?.FadeOut();
currentPage?.Expire();
switch (mode)
{
case ResultMode.Summary:
currentPage = new ResultsPageScore(score, Beatmap);
break;
case ResultMode.Ranking:
currentPage = new ResultsPageRanking(score, Beatmap);
break;
}
if (currentPage != null)
circleInner.Add(currentPage);
};
modeChangeButtons.Current.TriggerChange();
}
}
}
+92
View File
@@ -0,0 +1,92 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Ranking
{
internal class ResultsPage : Container
{
protected readonly Score Score;
protected readonly WorkingBeatmap Beatmap;
private CircularContainer content;
private Box fill;
protected override Container<Drawable> Content => content;
public ResultsPage(Score score, WorkingBeatmap beatmap)
{
Score = score;
Beatmap = beatmap;
RelativeSizeAxes = Axes.Both;
}
protected override void LoadComplete()
{
base.LoadComplete();
fill.Delay(400);
fill.FadeInFromZero(600);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AddInternal(new Drawable[]
{
fill = new Box
{
Alpha = 0,
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray6
},
new CircularContainer
{
EdgeEffect = new EdgeEffect
{
Colour = colours.GrayF.Opacity(0.8f),
Type = EdgeEffectType.Shadow,
Radius = 1,
},
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = 20,
BorderColour = Color4.White,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new Box{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
},
}
},
content = new CircularContainer
{
EdgeEffect = new EdgeEffect
{
Colour = Color4.Black.Opacity(0.2f),
Type = EdgeEffectType.Shadow,
Radius = 15,
},
RelativeSizeAxes = Axes.Both,
Masking = true,
Size = new Vector2(0.88f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
}
}
}
@@ -0,0 +1,42 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Select.Leaderboards;
using OpenTK;
namespace osu.Game.Screens.Ranking
{
internal class ResultsPageRanking : ResultsPage
{
public ResultsPageRanking(Score score, WorkingBeatmap beatmap = null) : base(score, beatmap)
{
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Children = new Drawable[]
{
new Box
{
Colour = colours.GrayE,
RelativeSizeAxes = Axes.Both,
},
new Leaderboard
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Beatmap = Beatmap.BeatmapInfo ?? Score.Beatmap,
Scale = new Vector2(0.7f)
}
};
}
}
}
@@ -0,0 +1,393 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Users;
using OpenTK;
using OpenTK.Graphics;
using System;
using System.Collections.Generic;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Beatmaps;
using osu.Game.Screens.Play;
using osu.Game.Rulesets.Scoring;
using osu.Framework.Graphics.Colour;
using System.Linq;
namespace osu.Game.Screens.Ranking
{
internal class ResultsPageScore : ResultsPage
{
private ScoreCounter scoreCounter;
public ResultsPageScore(Score score, WorkingBeatmap beatmap) : base(score, beatmap) { }
private FillFlowContainer<DrawableScoreStatistic> statisticsContainer;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
const float user_header_height = 120;
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = user_header_height },
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
}
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new UserHeader(Score.User)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = user_header_height,
},
new DrawableRank(Score.Rank)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(150, 60),
Margin = new MarginPadding(20),
},
new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = 60,
Children = new Drawable[]
{
new SongProgressGraph
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.5f,
Objects = Beatmap.Beatmap.HitObjects,
},
scoreCounter = new SlowScoreCounter(6)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = colours.PinkDarker,
Y = 10,
TextSize = 56,
},
}
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = colours.PinkDarker,
Shadow = false,
Font = @"Exo2.0-Bold",
TextSize = 16,
Text = "total score",
Margin = new MarginPadding { Bottom = 15 },
},
new BeatmapDetails(Beatmap.BeatmapInfo)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Margin = new MarginPadding { Bottom = 10 },
},
new DateDisplay(Score.Date)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new Container
{
RelativeSizeAxes = Axes.X,
Size = new Vector2(0.75f, 1),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Margin = new MarginPadding { Top = 10, Bottom = 10 },
Children = new Drawable[]
{
new Box
{
ColourInfo = ColourInfo.GradientHorizontal(
colours.GrayC.Opacity(0),
colours.GrayC.Opacity(0.9f)),
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f, 1),
},
new Box
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
ColourInfo = ColourInfo.GradientHorizontal(
colours.GrayC.Opacity(0.9f),
colours.GrayC.Opacity(0)),
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f, 1),
},
}
},
statisticsContainer = new FillFlowContainer<DrawableScoreStatistic>
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Horizontal,
LayoutDuration = 200,
LayoutEasing = EasingTypes.OutQuint
}
}
}
};
statisticsContainer.Children = Score.Statistics.Select(s => new DrawableScoreStatistic(s));
}
protected override void LoadComplete()
{
base.LoadComplete();
Schedule(() =>
{
scoreCounter.Increment(Score.TotalScore);
int delay = 0;
foreach (var s in statisticsContainer.Children)
{
s.FadeOut();
s.Delay(delay += 200);
s.FadeIn(300 + delay, EasingTypes.Out);
}
});
}
private class DrawableScoreStatistic : Container
{
private readonly KeyValuePair<string, dynamic> statistic;
public DrawableScoreStatistic(KeyValuePair<string, dynamic> statistic)
{
this.statistic = statistic;
AutoSizeAxes = Axes.Both;
Margin = new MarginPadding { Left = 5, Right = 5 };
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Children = new Drawable[]
{
new SpriteText {
Text = statistic.Value.ToString().PadLeft(4, '0'),
Colour = colours.Gray7,
TextSize = 30,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new SpriteText {
Text = statistic.Key,
Colour = colours.Gray7,
Font = @"Exo2.0-Bold",
Y = 26,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
};
}
}
private class DateDisplay : Container
{
private DateTime date;
public DateDisplay(DateTime date)
{
this.date = date;
AutoSizeAxes = Axes.Y;
Width = 140;
Masking = true;
CornerRadius = 5;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray6,
},
new OsuSpriteText
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Text = date.ToString("HH:mm"),
Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 },
Colour = Color4.White,
},
new OsuSpriteText
{
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Text = date.ToString("yyyy/MM/dd"),
Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 },
Colour = Color4.White,
}
};
}
}
private class BeatmapDetails : Container
{
private readonly BeatmapInfo beatmap;
private Bindable<bool> preferUnicode;
private readonly OsuSpriteText title;
private readonly OsuSpriteText artist;
private readonly OsuSpriteText versionMapper;
public BeatmapDetails(BeatmapInfo beatmap)
{
this.beatmap = beatmap;
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
new FillFlowContainer
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
title = new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Shadow = false,
TextSize = 24,
Font = @"Exo2.0-BoldItalic",
},
artist = new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Shadow = false,
TextSize = 20,
Font = @"Exo2.0-BoldItalic",
},
versionMapper = new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Shadow = false,
TextSize = 16,
Font = @"Exo2.0-Bold",
},
}
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, OsuConfigManager config)
{
title.Colour = artist.Colour = colours.BlueDarker;
versionMapper.Colour = colours.Gray8;
versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}";
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
preferUnicode.ValueChanged += unicode =>
{
title.Text = unicode ? beatmap.Metadata.TitleUnicode : beatmap.Metadata.Title;
artist.Text = unicode ? beatmap.Metadata.ArtistUnicode : beatmap.Metadata.Artist;
};
preferUnicode.TriggerChange();
}
}
private class UserHeader : Container
{
private readonly User user;
private readonly Sprite cover;
public UserHeader(User user)
{
this.user = user;
Children = new Drawable[]
{
cover = new Sprite
{
FillMode = FillMode.Fill,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new OsuSpriteText
{
Font = @"Exo2.0-RegularItalic",
Text = user.Username,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
TextSize = 30,
Padding = new MarginPadding { Bottom = 10 },
}
};
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
if (!string.IsNullOrEmpty(user.CoverUrl))
cover.Texture = textures.Get(user.CoverUrl);
}
}
private class SlowScoreCounter : ScoreCounter
{
protected override double RollingDuration => 3000;
protected override EasingTypes RollingEasing => EasingTypes.OutPow10;
public SlowScoreCounter(uint leading = 0) : base(leading)
{
DisplayedCountSpriteText.Shadow = false;
DisplayedCountSpriteText.Font = @"Venera-Light";
UseCommaSeparator = true;
}
}
}
}
+77 -37
View File
@@ -7,12 +7,15 @@ using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Backgrounds;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Game.Graphics;
using osu.Framework.Extensions.Color4Extensions;
namespace osu.Game.Screens
{
@@ -24,8 +27,8 @@ namespace osu.Game.Screens
protected virtual IEnumerable<Type> PossibleChildren => null;
private readonly Container textContainer;
private readonly Box box;
private readonly FillFlowContainer textContainer;
private readonly Container boxContainer;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");
@@ -40,13 +43,13 @@ namespace osu.Game.Screens
Content.Alpha = 0;
textContainer.Position = new Vector2(DrawSize.X / 16, 0);
box.ScaleTo(0.2f);
box.RotateTo(-20);
boxContainer.ScaleTo(0.2f);
boxContainer.RotateTo(-20);
Content.Delay(300, true);
box.ScaleTo(1, transition_time, EasingTypes.OutElastic);
box.RotateTo(0, transition_time / 2, EasingTypes.OutQuint);
boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic);
boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint);
textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo);
Content.FadeIn(transition_time, EasingTypes.OutExpo);
@@ -82,36 +85,62 @@ namespace osu.Game.Screens
Children = new Drawable[]
{
box = new Box
boxContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.3f),
RelativeSizeAxes = Axes.Both,
CornerRadius = 20,
Masking = true,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = getColourFor(GetType()),
Alpha = 1,
BlendingMode = BlendingMode.Additive,
},
textContainer = new Container
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new[]
Children = new Drawable[]
{
new OsuSpriteText
new Box
{
Text = GetType().Name,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 50,
RelativeSizeAxes = Axes.Both,
Colour = getColourFor(GetType()),
Alpha = 0.2f,
BlendingMode = BlendingMode.Additive,
},
new OsuSpriteText
textContainer = new FillFlowContainer
{
Text = GetType().Namespace,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Position = new Vector2(0, 30)
Direction = FillDirection.Vertical,
Children = new[]
{
new TextAwesome
{
Icon = FontAwesome.fa_universal_access,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 50,
},
new OsuSpriteText
{
Text = GetType().Name,
Colour = getColourFor(GetType()).Lighten(0.8f),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 50,
},
new OsuSpriteText
{
Text = "is not yet ready for use!",
TextSize = 20,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new OsuSpriteText
{
Text = "please check back a bit later.",
TextSize = 14,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
}
},
}
},
@@ -120,17 +149,15 @@ namespace osu.Game.Screens
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Alpha = 0,
Action = delegate {
Exit();
}
Action = Exit
},
childModeButtons = new FillFlowContainer
{
Direction = FillDirection.Vertical,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.1f, 1)
RelativeSizeAxes = Axes.Y,
Size = new Vector2(TwoLayerButton.SIZE_RETRACTED.X, 1)
}
};
@@ -138,14 +165,11 @@ namespace osu.Game.Screens
{
foreach (Type t in PossibleChildren)
{
childModeButtons.Add(new Button
childModeButtons.Add(new ChildModeButton
{
Text = $@"{t.Name}",
RelativeSizeAxes = Axes.X,
Size = new Vector2(1, 40),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
BackgroundColour = getColourFor(t),
HoverColour = getColourFor(t).Lighten(0.2f),
Action = delegate
{
Push(Activator.CreateInstance(t) as Screen);
@@ -163,5 +187,21 @@ namespace osu.Game.Screens
byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255);
return new Color4(r, g, b, 255);
}
public class ChildModeButton : TwoLayerButton
{
public ChildModeButton()
{
Icon = FontAwesome.fa_osu_right_o;
Anchor = Anchor.BottomRight;
Origin = Anchor.BottomRight;
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
ActivationSound = audio.Sample.Get(@"Menu/menuhit");
}
}
}
}
@@ -23,6 +23,8 @@ namespace osu.Game.Screens.Select.Leaderboards
private readonly ScrollContainer scrollContainer;
private readonly FillFlowContainer<LeaderboardScore> scrollFlow;
public Action<Score> ScoreSelected;
private IEnumerable<Score> scores;
public IEnumerable<Score> Scores
{
@@ -52,6 +54,7 @@ namespace osu.Game.Screens.Select.Leaderboards
var ls = new LeaderboardScore(s, 1 + i)
{
AlwaysPresent = true,
Action = () => ScoreSelected?.Invoke(s),
State = Visibility.Hidden,
};
scrollFlow.Add(ls);
@@ -17,7 +17,7 @@ using osu.Game.Rulesets.Scoring;
namespace osu.Game.Screens.Select.Leaderboards
{
public class LeaderboardScore : Container, IStateful<Visibility>
public class LeaderboardScore : ClickableContainer, IStateful<Visibility>
{
public static readonly float HEIGHT = 60;
@@ -12,6 +12,7 @@ using osu.Game.Graphics;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
namespace osu.Game.Screens.Select
{
@@ -35,6 +36,8 @@ namespace osu.Game.Screens.Select
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 10, Right = 5 },
});
beatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s));
}
[BackgroundDependencyLoader]
+12 -9
View File
@@ -13,24 +13,29 @@ namespace osu.Game.Users
[JsonProperty(@"username")]
public string Username;
//[JsonProperty(@"country")]
[JsonIgnore]
[JsonProperty(@"country_code")]
public string CountryCode;
[JsonProperty(@"country")]
public Country Country;
//public Team Team;
[JsonProperty(@"colour")]
[JsonProperty(@"profile_colour")]
public string Colour;
[JsonProperty(@"avatarUrl")]
[JsonProperty(@"avatar_url")]
public string AvatarUrl;
[JsonProperty(@"cover")]
public UserCover Cover;
[JsonProperty(@"cover_url")]
public string CoverUrl;
//[JsonProperty(@"cover")]
//public UserCover Cover;
public class UserCover
{
[JsonProperty(@"customUrl")]
[JsonProperty(@"custom_url")]
public string CustomUrl;
[JsonProperty(@"url")]
@@ -40,6 +45,4 @@ namespace osu.Game.Users
public int? Id;
}
}
}
+25
View File
@@ -57,6 +57,7 @@
<HintPath>$(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="DotNetZip">
@@ -87,6 +88,7 @@
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
<Compile Include="Graphics\IHasAccentColour.cs" />
<Compile Include="Graphics\IHasTooltip.cs" />
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
<Compile Include="Graphics\Transforms\TransformAccent.cs" />
<Compile Include="Graphics\UserInterface\BackButton.cs" />
@@ -99,6 +101,7 @@
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
<Compile Include="Graphics\UserInterface\SimpleComboCounter.cs" />
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
<Compile Include="Graphics\Cursor\TooltipContainer.cs" />
<Compile Include="Input\Handlers\ReplayInputHandler.cs" />
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
<Compile Include="IO\Legacy\SerializationReader.cs" />
@@ -106,6 +109,21 @@
<Compile Include="IO\Serialization\IJsonSerializable.cs" />
<Compile Include="IPC\ScoreIPCChannel.cs" />
<Compile Include="Rulesets\BeatmapStatistic.cs" />
<Compile Include="Rulesets\Mods\IApplicableToClock.cs" />
<Compile Include="Rulesets\Mods\ModAutoplay.cs" />
<Compile Include="Rulesets\Mods\ModCinema.cs" />
<Compile Include="Rulesets\Mods\ModDoubleTime.cs" />
<Compile Include="Rulesets\Mods\ModEasy.cs" />
<Compile Include="Rulesets\Mods\ModFlashlight.cs" />
<Compile Include="Rulesets\Mods\ModHalfTime.cs" />
<Compile Include="Rulesets\Mods\ModHardRock.cs" />
<Compile Include="Rulesets\Mods\ModHidden.cs" />
<Compile Include="Rulesets\Mods\ModNightcore.cs" />
<Compile Include="Rulesets\Mods\ModNoFail.cs" />
<Compile Include="Rulesets\Mods\ModPerfect.cs" />
<Compile Include="Rulesets\Mods\ModRelax.cs" />
<Compile Include="Rulesets\Mods\ModSuddenDeath.cs" />
<Compile Include="Rulesets\Mods\MultiMod.cs" />
<Compile Include="Rulesets\Objects\Legacy\Catch\Hit.cs" />
<Compile Include="Rulesets\Objects\Legacy\Catch\HitObjectParser.cs" />
<Compile Include="Rulesets\Objects\Legacy\Catch\Slider.cs" />
@@ -204,6 +222,9 @@
<Compile Include="Screens\Edit\Editor.cs" />
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
<Compile Include="Screens\Play\SquareGraph.cs" />
<Compile Include="Screens\Ranking\ResultsPage.cs" />
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />
<Compile Include="Screens\Ranking\ResultsPageScore.cs" />
<Compile Include="Screens\ScreenWhiteBox.cs" />
<Compile Include="Screens\Loader.cs" />
<Compile Include="Screens\Menu\Button.cs" />
@@ -227,6 +248,10 @@
<Compile Include="Screens\Play\ReplayPlayer.cs" />
<Compile Include="Screens\Play\SkipButton.cs" />
<Compile Include="Rulesets\UI\StandardComboCounter.cs" />
<Compile Include="Screens\Ranking\AspectContainer.cs" />
<Compile Include="Screens\Ranking\ResultMode.cs" />
<Compile Include="Screens\Ranking\ResultModeButton.cs" />
<Compile Include="Screens\Ranking\ResultModeTabControl.cs" />
<Compile Include="Screens\Select\BeatmapCarousel.cs" />
<Compile Include="Screens\Select\BeatmapDetails.cs" />
<Compile Include="Graphics\UserInterface\BarGraph.cs" />