From ee1c3d42d884167d1657027ca9dad17704df7231 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Tue, 20 Aug 2019 21:11:26 +0300 Subject: [PATCH 001/106] Add spinner tick judgement --- .../Judgements/OsuSpinnerTickJudgement.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs new file mode 100644 index 0000000000..f9cac7a2c1 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs @@ -0,0 +1,18 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Osu.Judgements +{ + public class OsuSpinnerTickJudgement : OsuJudgement + { + internal bool HasBonusPoints; + + public override bool AffectsCombo => false; + + protected override int NumericResultFor(HitResult result) => 100 + (HasBonusPoints ? 1000 : 0); + + protected override double HealthIncreaseFor(HitResult result) => 0; + } +} From bb4178fa037a2b9a4d361b7a89715958d773db3e Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Tue, 20 Aug 2019 21:17:27 +0300 Subject: [PATCH 002/106] Add drawable spinner ticks implementation --- .../Objects/Drawables/DrawableSpinnerTick.cs | 49 +++++++++++++++++++ osu.Game.Rulesets.Osu/Objects/Spinner.cs | 11 +++++ osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs | 19 +++++++ .../Replays/OsuAutoGeneratorBase.cs | 2 +- 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs create mode 100644 osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs new file mode 100644 index 0000000000..9c316591a9 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -0,0 +1,49 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Audio; +using osu.Framework.Bindables; +using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables +{ + public class DrawableSpinnerTick : DrawableOsuHitObject + { + private readonly BindableDouble bonusSampleVolume = new BindableDouble(); + + private bool hasBonusPoints; + + /// + /// Whether this judgement has a bonus of 1,000 points additional to the numeric result. + /// Should be set when a spin occured after the spinner has completed. + /// + public bool HasBonusPoints + { + get => hasBonusPoints; + internal set + { + hasBonusPoints = value; + + bonusSampleVolume.Value = value ? 1 : 0; + ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints = value; + } + } + + public override bool DisplayResult => false; + + public DrawableSpinnerTick(SpinnerTick spinnerTick) + : base(spinnerTick) + { + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + Samples.AddAdjustment(AdjustableProperty.Volume, bonusSampleVolume); + } + + public void TriggerResult(HitResult result) => ApplyResult(r => r.Type = result); + } +} diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 8a2fd3b7aa..c32ec7be1c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -7,6 +7,8 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Osu.Replays; +using osuTK; namespace osu.Game.Rulesets.Osu.Objects { @@ -30,6 +32,15 @@ protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, B SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6); } + protected override void CreateNestedHitObjects() + { + base.CreateNestedHitObjects(); + + var maximumSpins = OsuAutoGeneratorBase.SPIN_RADIUS * (Duration / 1000) / MathHelper.TwoPi; + for (int i = 0; i < maximumSpins; i++) + AddNested(new SpinnerTick()); + } + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs new file mode 100644 index 0000000000..18a3dc771b --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Audio; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Judgements; + +namespace osu.Game.Rulesets.Osu.Objects +{ + public class SpinnerTick : OsuHitObject + { + public SpinnerTick() + { + Samples.Add(new HitSampleInfo { Name = "spinnerbonus" }); + } + + public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement(); + } +} diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs index 9ab358ee12..3356a0fbe0 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs @@ -20,7 +20,7 @@ public abstract class OsuAutoGeneratorBase : AutoGenerator /// protected static readonly Vector2 SPINNER_CENTRE = OsuPlayfield.BASE_SIZE / 2; - protected const float SPIN_RADIUS = 50; + public const float SPIN_RADIUS = 50; /// /// The time in ms between each ReplayFrame. From 07795c9922cc4b3ce5197010b03fc53e0b1f565b Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Tue, 20 Aug 2019 21:50:49 +0300 Subject: [PATCH 003/106] Add logic to gain bonus score from spinner ticks --- .../Objects/Drawables/DrawableSpinner.cs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index a0bd301fdb..d166d6b845 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -12,7 +12,9 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics.Sprites; using osu.Game.Screens.Ranking; using osu.Game.Rulesets.Scoring; @@ -22,6 +24,9 @@ public class DrawableSpinner : DrawableOsuHitObject { protected readonly Spinner Spinner; + private readonly Container ticks; + private readonly OsuSpriteText bonusCounter; + public readonly SpinnerDisc Disc; public readonly SpinnerTicks Ticks; private readonly SpinnerSpmCounter spmCounter; @@ -58,6 +63,7 @@ public DrawableSpinner(Spinner s) InternalChildren = new Drawable[] { + ticks = new Container(), circleContainer = new Container { AutoSizeAxes = Axes.Both, @@ -115,8 +121,24 @@ public DrawableSpinner(Spinner s) Origin = Anchor.Centre, Y = 120, Alpha = 0 + }, + bonusCounter = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Y = -120, + Font = OsuFont.Numeric.With(size: 24), + Alpha = 0, } }; + + foreach (var tick in Spinner.NestedHitObjects.OfType()) + { + var drawableTick = new DrawableSpinnerTick(tick); + + ticks.Add(drawableTick); + AddNested(drawableTick); + } } [BackgroundDependencyLoader] @@ -182,6 +204,8 @@ protected override void Update() base.Update(); } + private int currentSpins; + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); @@ -190,6 +214,22 @@ protected override void UpdateAfterChildren() Ticks.Rotation = Disc.Rotation; spmCounter.SetRotation(Disc.RotationAbsolute); + var newSpins = (int)(Disc.RotationAbsolute / 360) - currentSpins; + + for (int i = currentSpins; i < currentSpins + newSpins; i++) + { + if (i < 0 || i >= ticks.Count) + break; + + var tick = ticks[i]; + + tick.HasBonusPoints = Progress >= 1 && i > Spinner.SpinsRequired; + + tick.TriggerResult(HitResult.Great); + } + + currentSpins += newSpins; + float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; Disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint); @@ -232,6 +272,9 @@ protected override void UpdateStateTransforms(ArmedState state) break; } + if (state != ArmedState.Idle) + Schedule(() => NestedHitObjects.Where(t => !t.IsHit).OfType().ForEach(t => t.TriggerResult(HitResult.Miss))); + Expire(); } } From e4179fe4403232aa5663c80c7ee21800a20bd204 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Tue, 20 Aug 2019 21:51:32 +0300 Subject: [PATCH 004/106] Show bonus text if contains bonus points (1,000) --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index d166d6b845..b97f4e0a57 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -225,6 +225,12 @@ protected override void UpdateAfterChildren() tick.HasBonusPoints = Progress >= 1 && i > Spinner.SpinsRequired; + if (tick.HasBonusPoints) + bonusCounter + .TransformTextTo($"{(i - Spinner.SpinsRequired) * 1000}") + .FadeOutFromOne(1500) + .ScaleTo(1.5f).ScaleTo(1f, 1000, Easing.OutQuint); + tick.TriggerResult(HitResult.Great); } From dbf4884cbc64c736b16d334a2ed29e3f7780ce5b Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Tue, 20 Aug 2019 21:52:13 +0300 Subject: [PATCH 005/106] Adjust test spinner rotation --- osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs index 3ed3f3e981..6e0745d125 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs @@ -64,7 +64,7 @@ private void testSingle(float circleSize, bool auto = false) private class TestDrawableSpinner : DrawableSpinner { - private bool auto; + private readonly bool auto; public TestDrawableSpinner(Spinner s, bool auto) : base(s) @@ -74,12 +74,8 @@ public TestDrawableSpinner(Spinner s, bool auto) protected override void CheckForResult(bool userTriggered, double timeOffset) { - if (auto && !userTriggered && Time.Current > Spinner.StartTime + Spinner.Duration / 2 && Progress < 1) - { - // force completion only once to not break human interaction - Disc.RotationAbsolute = Spinner.SpinsRequired * 360; - auto = false; - } + if (auto && !userTriggered && Time.Current > Spinner.StartTime) + Disc.RotationAbsolute += Progress >= 1 ? 10 : (float)(Spinner.Duration / 120); base.CheckForResult(userTriggered, timeOffset); } From 6b7cb46ddaf9518e9f876535a86f385ed0db1a26 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sat, 7 Sep 2019 17:27:02 +0300 Subject: [PATCH 006/106] Add null hit windows --- osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs index 18a3dc771b..c2104e68ee 100644 --- a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs @@ -4,6 +4,7 @@ using osu.Game.Audio; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects { @@ -15,5 +16,7 @@ public SpinnerTick() } public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement(); + + protected override HitWindows CreateHitWindows() => null; } } From 33f4a6897cd315ba7e3790378a586a9adf424b1d Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sat, 7 Sep 2019 18:01:15 +0300 Subject: [PATCH 007/106] Assign to the text property directly --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index fc1e410d5f..62cec0f124 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -226,10 +226,12 @@ protected override void UpdateAfterChildren() tick.HasBonusPoints = Progress >= 1 && i > Spinner.SpinsRequired; if (tick.HasBonusPoints) + { + bonusCounter.Text = $"{(i - Spinner.SpinsRequired) * 1000}"; bonusCounter - .TransformTextTo($"{(i - Spinner.SpinsRequired) * 1000}") .FadeOutFromOne(1500) .ScaleTo(1.5f).ScaleTo(1f, 1000, Easing.OutQuint); + } tick.TriggerResult(HitResult.Great); } From 5d2fe8733997295bbbecee0cdbc947440e305d06 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 14 Oct 2019 00:38:45 +0300 Subject: [PATCH 008/106] Use empty hit windows for spinner ticks --- osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs index c2104e68ee..318e8e71a2 100644 --- a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs @@ -17,6 +17,6 @@ public SpinnerTick() public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement(); - protected override HitWindows CreateHitWindows() => null; + protected override HitWindows CreateHitWindows() => HitWindows.Empty; } } From 68e370ce7cd72c51a7eda6f9863ed37b0f86b3d5 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 14 Oct 2019 00:39:20 +0300 Subject: [PATCH 009/106] Set spinner tick start time to allow result reverting --- .../Objects/Drawables/DrawableSpinnerTick.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 9c316591a9..21cf7b3acb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -44,6 +44,10 @@ protected override void LoadComplete() Samples.AddAdjustment(AdjustableProperty.Volume, bonusSampleVolume); } - public void TriggerResult(HitResult result) => ApplyResult(r => r.Type = result); + public void TriggerResult(HitResult result) + { + HitObject.StartTime = Time.Current; + ApplyResult(r => r.Type = result); + } } } From a75ae14cb20efca1673d863001736361c29c07f8 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 14 Oct 2019 00:40:36 +0300 Subject: [PATCH 010/106] Use foreach loop to avoid too long lines --- .../Objects/Drawables/DrawableSpinner.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 08e64b7ecf..965303ba7a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -12,7 +12,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Scoring; @@ -279,7 +278,13 @@ protected override void UpdateStateTransforms(ArmedState state) } if (state != ArmedState.Idle) - Schedule(() => NestedHitObjects.Where(t => !t.IsHit).OfType().ForEach(t => t.TriggerResult(HitResult.Miss))); + { + Schedule(() => + { + foreach (var tick in ticks.Where(t => !t.IsHit)) + tick.TriggerResult(HitResult.Miss); + }); + } } } } From a8514ecd0f220f39c214e13cd89409f1a6694c3e Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Mon, 14 Oct 2019 00:43:46 +0300 Subject: [PATCH 011/106] Add tests ensuring correct spinner ticks score results --- .../TestSceneSpinnerRotation.cs | 45 ++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs index cded7f0e95..b03788a7d6 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs @@ -15,6 +15,8 @@ using osuTK; using System.Collections.Generic; using System.Linq; +using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Play; using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap; namespace osu.Game.Rulesets.Osu.Tests @@ -28,6 +30,8 @@ public class TestSceneSpinnerRotation : TestSceneOsuPlayer protected override bool Autoplay => true; + protected override Player CreatePlayer(Ruleset ruleset) => new ScoreExposedPlayer(); + protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap) { var working = new ClockBackedTestWorkingBeatmap(beatmap, new FramedClock(new ManualClock { Rate = 1 }), audioManager); @@ -69,6 +73,32 @@ public void TestSpinnerMiddleRewindingRotation() AddAssert("is rotation absolute almost same", () => Precision.AlmostEquals(drawableSpinner.Disc.RotationAbsolute, estimatedRotation, 100)); } + [Test] + public void TestSpinnerNormalBonusRewinding() + { + addSeekStep(1000); + + AddAssert("player score matching expected bonus score", () => + { + // multipled by 2 to nullify the score multiplier. (autoplay mod selected) + var totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2; + return totalScore == (int)(drawableSpinner.Disc.RotationAbsolute / 360) * 100; + }); + + addSeekStep(0); + + AddAssert("player score is 0", () => ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value == 0); + } + + [Test] + public void TestSpinnerCompleteBonusRewinding() + { + addSeekStep(2500); + addSeekStep(0); + + AddAssert("player score is 0", () => ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value == 0); + } + private void addSeekStep(double time) { AddStep($"seek to {time}", () => track.Seek(time)); @@ -85,12 +115,17 @@ private void addSeekStep(double time) Position = new Vector2(256, 192), EndTime = 5000, }, - // placeholder object to avoid hitting the results screen - new HitObject - { - StartTime = 99999, - } } }; + + private class ScoreExposedPlayer : TestPlayer + { + public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; + + public ScoreExposedPlayer() + : base(false, false) + { + } + } } } From 10e1e512fd45abf199bea01c8d70ebfa2337df4c Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 12 Dec 2019 15:15:16 +0300 Subject: [PATCH 012/106] Update the nested hitobject logic inline with new implementation --- .../Objects/Drawables/DrawableSpinner.cs | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 39330f08c3..2c21b4244a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -15,6 +15,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; @@ -131,16 +132,37 @@ public DrawableSpinner(Spinner s) Alpha = 0, } }; + } - foreach (var tick in Spinner.NestedHitObjects.OfType()) + protected override void AddNestedHitObject(DrawableHitObject hitObject) + { + base.AddNestedHitObject(hitObject); + + switch (hitObject) { - var drawableTick = new DrawableSpinnerTick(tick); - - ticks.Add(drawableTick); - AddNestedHitObject(drawableTick); + case DrawableSpinnerTick tick: + ticks.Add(tick); + break; } } + protected override void ClearNestedHitObjects() + { + base.ClearNestedHitObjects(); + ticks.Clear(); + } + + protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject) + { + switch (hitObject) + { + case SpinnerTick tick: + return new DrawableSpinnerTick(tick); + } + + return base.CreateNestedHitObject(hitObject); + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { From 949ab4e0d3889e4ea88850b49715c1e3f8cc46d2 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 25 Dec 2019 05:34:12 +0300 Subject: [PATCH 013/106] Move spinner bonus scoring to it's own component class Also fixes counter rewinding issue and does optimizations. --- .../Objects/Drawables/DrawableSpinner.cs | 42 +-------- .../Objects/Drawables/DrawableSpinnerTick.cs | 10 ++- .../Drawables/Pieces/SpinnerBonusComponent.cs | 90 +++++++++++++++++++ 3 files changed, 100 insertions(+), 42 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index f7f4275d2a..86e8840425 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -26,11 +26,11 @@ public class DrawableSpinner : DrawableOsuHitObject protected readonly Spinner Spinner; private readonly Container ticks; - private readonly OsuSpriteText bonusCounter; public readonly SpinnerDisc Disc; public readonly SpinnerTicks Ticks; public readonly SpinnerSpmCounter SpmCounter; + private readonly SpinnerBonusComponent bonusComponent; private readonly Container mainContainer; @@ -123,13 +123,11 @@ public DrawableSpinner(Spinner s) Y = 120, Alpha = 0 }, - bonusCounter = new OsuSpriteText + bonusComponent = new SpinnerBonusComponent(this, ticks) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Y = -120, - Font = OsuFont.Numeric.With(size: 24), - Alpha = 0, } }; } @@ -226,8 +224,6 @@ protected override void Update() base.Update(); } - private int currentSpins; - protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); @@ -235,30 +231,7 @@ protected override void UpdateAfterChildren() circle.Rotation = Disc.Rotation; Ticks.Rotation = Disc.Rotation; SpmCounter.SetRotation(Disc.RotationAbsolute); - - var newSpins = (int)(Disc.RotationAbsolute / 360) - currentSpins; - - for (int i = currentSpins; i < currentSpins + newSpins; i++) - { - if (i < 0 || i >= ticks.Count) - break; - - var tick = ticks[i]; - - tick.HasBonusPoints = Progress >= 1 && i > Spinner.SpinsRequired; - - if (tick.HasBonusPoints) - { - bonusCounter.Text = $"{(i - Spinner.SpinsRequired) * 1000}"; - bonusCounter - .FadeOutFromOne(1500) - .ScaleTo(1.5f).ScaleTo(1f, 1000, Easing.OutQuint); - } - - tick.TriggerResult(HitResult.Great); - } - - currentSpins += newSpins; + bonusComponent.UpdateRotation(Disc.RotationAbsolute); float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; Disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint); @@ -299,15 +272,6 @@ protected override void UpdateStateTransforms(ArmedState state) sequence.ScaleTo(Scale * 0.8f, 320, Easing.In); break; } - - if (state != ArmedState.Idle) - { - Schedule(() => - { - foreach (var tick in ticks.Where(t => !t.IsHit)) - tick.TriggerResult(HitResult.Miss); - }); - } } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 21cf7b3acb..6512a9526e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -16,7 +16,7 @@ public class DrawableSpinnerTick : DrawableOsuHitObject /// /// Whether this judgement has a bonus of 1,000 points additional to the numeric result. - /// Should be set when a spin occured after the spinner has completed. + /// Set when a spin occured after the spinner has completed. /// public bool HasBonusPoints { @@ -44,10 +44,14 @@ protected override void LoadComplete() Samples.AddAdjustment(AdjustableProperty.Volume, bonusSampleVolume); } - public void TriggerResult(HitResult result) + /// + /// Apply a judgement result. + /// + /// Whether to apply a result, otherwise. + internal void TriggerResult(bool hit) { HitObject.StartTime = Time.Current; - ApplyResult(r => r.Type = result); + ApplyResult(r => r.Type = hit ? HitResult.Great : HitResult.Miss); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs new file mode 100644 index 0000000000..5c96751b3a --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs @@ -0,0 +1,90 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces +{ + /// + /// A component that tracks spinner spins and add bonus score for it. + /// + public class SpinnerBonusComponent : CompositeDrawable + { + private readonly DrawableSpinner drawableSpinner; + private readonly Container ticks; + private readonly OsuSpriteText bonusCounter; + + public SpinnerBonusComponent(DrawableSpinner drawableSpinner, Container ticks) + { + this.drawableSpinner = drawableSpinner; + this.ticks = ticks; + + drawableSpinner.OnNewResult += onNewResult; + + AutoSizeAxes = Axes.Both; + InternalChild = bonusCounter = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.Numeric.With(size: 24), + Alpha = 0, + }; + } + + private int currentSpins; + + public void UpdateRotation(double rotation) + { + if (ticks.Count == 0) + return; + + int spinsRequired = ((Spinner)drawableSpinner.HitObject).SpinsRequired; + + int newSpins = Math.Clamp((int)(rotation / 360), 0, ticks.Count - 1); + int direction = Math.Sign(newSpins - currentSpins); + + while (currentSpins != newSpins) + { + var tick = ticks[currentSpins]; + + if (direction >= 0) + { + tick.HasBonusPoints = currentSpins > spinsRequired; + tick.TriggerResult(true); + } + + if (tick.HasBonusPoints) + { + bonusCounter.Text = $"{1000 * (currentSpins - spinsRequired)}"; + bonusCounter.FadeOutFromOne(1500); + bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint); + } + + currentSpins += direction; + } + } + + private void onNewResult(DrawableHitObject hitObject, JudgementResult result) + { + if (!result.HasResult || hitObject != drawableSpinner) + return; + + // Trigger a miss result for remaining ticks to avoid infinite gameplay. + foreach (var tick in ticks.Where(t => !t.IsHit)) + tick.TriggerResult(false); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + drawableSpinner.OnNewResult -= onNewResult; + } + } +} From b7565f5943f05247b6469491f052dd6287c95db3 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 25 Dec 2019 05:36:58 +0300 Subject: [PATCH 014/106] Remove unnecessary using directive --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 86e8840425..edcaa947ac 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -14,7 +14,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; From 641ea5b950f6087d79b24b8339e2f5fa9b4bc10a Mon Sep 17 00:00:00 2001 From: Lucas A Date: Tue, 30 Jun 2020 13:12:33 +0200 Subject: [PATCH 015/106] Make the disabling of the win key during gameplay a toggleable setting. --- osu.Game/Configuration/OsuConfigManager.cs | 4 +++- .../Overlays/Settings/Sections/Gameplay/GeneralSettings.cs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 9d31bc9bba..e7a86e080d 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -98,6 +98,7 @@ protected override void InitialiseDefaults() Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised); Set(OsuSetting.IncreaseFirstObjectVisibility, true); + Set(OsuSetting.GameplayDisableWinKey, true); // Update Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); @@ -227,6 +228,7 @@ public enum OsuSetting IntroSequence, UIHoldActivationDelay, HitLighting, - MenuBackgroundSource + MenuBackgroundSource, + GameplayDisableWinKey } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 93a02ea0e4..60197c62b5 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -76,6 +76,11 @@ private void load(OsuConfigManager config) { LabelText = "Score display mode", Bindable = config.GetBindable(OsuSetting.ScoreDisplayMode) + }, + new SettingsCheckbox + { + LabelText = "Disable Win key during gameplay", + Bindable = config.GetBindable(OsuSetting.GameplayDisableWinKey) } }; } From fc1eb42a650fef5497bec37e20b5e2a29f773c07 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Wed, 1 Jul 2020 17:15:41 +0200 Subject: [PATCH 016/106] Disable windows key while in gameplay. --- osu.Desktop/OsuGameDesktop.cs | 4 + osu.Desktop/Windows/GameplayWinKeyHandler.cs | 39 ++++++++++ osu.Desktop/Windows/WindowsKey.cs | 82 ++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 osu.Desktop/Windows/GameplayWinKeyHandler.cs create mode 100644 osu.Desktop/Windows/WindowsKey.cs diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index cd31df316a..d05a4af126 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -16,6 +16,7 @@ using osu.Framework.Screens; using osu.Game.Screens.Menu; using osu.Game.Updater; +using osu.Desktop.Windows; namespace osu.Desktop { @@ -98,6 +99,9 @@ protected override void LoadComplete() LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, Add); LoadComponentAsync(new DiscordRichPresence(), Add); + + if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) + LoadComponentAsync(new GameplayWinKeyHandler(), Add); } protected override void ScreenChanged(IScreen lastScreen, IScreen newScreen) diff --git a/osu.Desktop/Windows/GameplayWinKeyHandler.cs b/osu.Desktop/Windows/GameplayWinKeyHandler.cs new file mode 100644 index 0000000000..cc0150497b --- /dev/null +++ b/osu.Desktop/Windows/GameplayWinKeyHandler.cs @@ -0,0 +1,39 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Platform; +using osu.Game.Configuration; + +namespace osu.Desktop.Windows +{ + public class GameplayWinKeyHandler : Component + { + private Bindable winKeyEnabled; + private Bindable disableWinKey; + + private GameHost host; + + [BackgroundDependencyLoader] + private void load(GameHost host, OsuConfigManager config) + { + this.host = host; + + winKeyEnabled = host.AllowScreenSuspension.GetBoundCopy(); + winKeyEnabled.ValueChanged += toggleWinKey; + + disableWinKey = config.GetBindable(OsuSetting.GameplayDisableWinKey); + disableWinKey.BindValueChanged(t => winKeyEnabled.TriggerChange()); + } + + private void toggleWinKey(ValueChangedEvent e) + { + if (!e.NewValue && disableWinKey.Value) + host.InputThread.Scheduler.Add(WindowsKey.Disable); + else + host.InputThread.Scheduler.Add(WindowsKey.Enable); + } + } +} diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs new file mode 100644 index 0000000000..748d9c55d6 --- /dev/null +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -0,0 +1,82 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Runtime.InteropServices; + +namespace osu.Desktop.Windows +{ + internal class WindowsKey + { + private delegate int LowLevelKeyboardProcDelegate(int nCode, int wParam, ref KdDllHookStruct lParam); + + private static bool isBlocked; + + private const int wh_keyboard_ll = 13; + private const int wm_keydown = 256; + private const int wm_syskeyup = 261; + + //Resharper disable once NotAccessedField.Local + private static LowLevelKeyboardProcDelegate keyboardHookDelegate; // keeping a reference alive for the GC + private static IntPtr keyHook; + + [StructLayout(LayoutKind.Explicit)] + private struct KdDllHookStruct + { + [FieldOffset(0)] + public readonly int VkCode; + + [FieldOffset(8)] + public readonly int Flags; + } + + private static int lowLevelKeyboardProc(int nCode, int wParam, ref KdDllHookStruct lParam) + { + if (wParam >= wm_keydown && wParam <= wm_syskeyup) + { + switch (lParam.VkCode) + { + case 0x09 when lParam.Flags == 32: // alt + tab + case 0x1b when lParam.Flags == 32: // alt + esc + case 0x5B: // left windows key + case 0x5C: // right windows key + return 1; + } + } + + return callNextHookEx(0, nCode, wParam, ref lParam); + } + + internal static void Disable() + { + if (keyHook != IntPtr.Zero || isBlocked) + return; + + keyHook = setWindowsHookEx(wh_keyboard_ll, (keyboardHookDelegate = lowLevelKeyboardProc), Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0]), 0); + + isBlocked = true; + } + + internal static void Enable() + { + if (keyHook == IntPtr.Zero || !isBlocked) + return; + + keyHook = unhookWindowsHookEx(keyHook); + keyboardHookDelegate = null; + + keyHook = IntPtr.Zero; + + isBlocked = false; + } + + [DllImport(@"user32.dll", EntryPoint = @"SetWindowsHookExA")] + private static extern IntPtr setWindowsHookEx(int idHook, LowLevelKeyboardProcDelegate lpfn, IntPtr hMod, int dwThreadId); + + [DllImport(@"user32.dll", EntryPoint = @"UnhookWindowsHookEx")] + private static extern IntPtr unhookWindowsHookEx(IntPtr hHook); + + [DllImport(@"user32.dll", EntryPoint = @"CallNextHookEx")] + private static extern int callNextHookEx(int hHook, int nCode, int wParam, ref KdDllHookStruct lParam); + } +} From 8869979599b2b79371b0ef2278a5f32f7200e883 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sat, 4 Jul 2020 12:30:09 +0200 Subject: [PATCH 017/106] Trigger hook activation on bind. --- osu.Desktop/Windows/GameplayWinKeyHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Windows/GameplayWinKeyHandler.cs b/osu.Desktop/Windows/GameplayWinKeyHandler.cs index cc0150497b..394df9dd0c 100644 --- a/osu.Desktop/Windows/GameplayWinKeyHandler.cs +++ b/osu.Desktop/Windows/GameplayWinKeyHandler.cs @@ -25,7 +25,7 @@ private void load(GameHost host, OsuConfigManager config) winKeyEnabled.ValueChanged += toggleWinKey; disableWinKey = config.GetBindable(OsuSetting.GameplayDisableWinKey); - disableWinKey.BindValueChanged(t => winKeyEnabled.TriggerChange()); + disableWinKey.BindValueChanged(t => winKeyEnabled.TriggerChange(), true); } private void toggleWinKey(ValueChangedEvent e) From ce5da5c51b98136503052eb11df547497019e6fb Mon Sep 17 00:00:00 2001 From: Lucas A Date: Sun, 5 Jul 2020 18:52:27 +0200 Subject: [PATCH 018/106] Block CTRL + ESC --- osu.Desktop/Windows/GameplayWinKeyHandler.cs | 8 ++++---- osu.Desktop/Windows/WindowsKey.cs | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Desktop/Windows/GameplayWinKeyHandler.cs b/osu.Desktop/Windows/GameplayWinKeyHandler.cs index 394df9dd0c..4f74a4f492 100644 --- a/osu.Desktop/Windows/GameplayWinKeyHandler.cs +++ b/osu.Desktop/Windows/GameplayWinKeyHandler.cs @@ -11,7 +11,7 @@ namespace osu.Desktop.Windows { public class GameplayWinKeyHandler : Component { - private Bindable winKeyEnabled; + private Bindable allowScreenSuspension; private Bindable disableWinKey; private GameHost host; @@ -21,11 +21,11 @@ private void load(GameHost host, OsuConfigManager config) { this.host = host; - winKeyEnabled = host.AllowScreenSuspension.GetBoundCopy(); - winKeyEnabled.ValueChanged += toggleWinKey; + allowScreenSuspension = host.AllowScreenSuspension.GetBoundCopy(); + allowScreenSuspension.ValueChanged += toggleWinKey; disableWinKey = config.GetBindable(OsuSetting.GameplayDisableWinKey); - disableWinKey.BindValueChanged(t => winKeyEnabled.TriggerChange(), true); + disableWinKey.BindValueChanged(t => allowScreenSuspension.TriggerChange(), true); } private void toggleWinKey(ValueChangedEvent e) diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs index 748d9c55d6..175401aaed 100644 --- a/osu.Desktop/Windows/WindowsKey.cs +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -38,6 +38,7 @@ private static int lowLevelKeyboardProc(int nCode, int wParam, ref KdDllHookStru { case 0x09 when lParam.Flags == 32: // alt + tab case 0x1b when lParam.Flags == 32: // alt + esc + case 0x1b when (getKeyState(0x11) & 0x8000) != 0: //ctrl + esc case 0x5B: // left windows key case 0x5C: // right windows key return 1; @@ -78,5 +79,8 @@ internal static void Enable() [DllImport(@"user32.dll", EntryPoint = @"CallNextHookEx")] private static extern int callNextHookEx(int hHook, int nCode, int wParam, ref KdDllHookStruct lParam); + + [DllImport(@"user32.dll", EntryPoint = @"GetKeyState")] + private static extern int getKeyState(int vkey); } } From 022e4b6335c0ebdfbc48ec4f1764ba04257a01b4 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Mon, 6 Jul 2020 11:15:56 +0200 Subject: [PATCH 019/106] Apply review suggestions. --- osu.Desktop/Windows/WindowsKey.cs | 6 ------ .../Settings/Sections/Gameplay/GeneralSettings.cs | 15 ++++++++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs index 175401aaed..4a815b135e 100644 --- a/osu.Desktop/Windows/WindowsKey.cs +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -36,9 +36,6 @@ private static int lowLevelKeyboardProc(int nCode, int wParam, ref KdDllHookStru { switch (lParam.VkCode) { - case 0x09 when lParam.Flags == 32: // alt + tab - case 0x1b when lParam.Flags == 32: // alt + esc - case 0x1b when (getKeyState(0x11) & 0x8000) != 0: //ctrl + esc case 0x5B: // left windows key case 0x5C: // right windows key return 1; @@ -79,8 +76,5 @@ internal static void Enable() [DllImport(@"user32.dll", EntryPoint = @"CallNextHookEx")] private static extern int callNextHookEx(int hHook, int nCode, int wParam, ref KdDllHookStruct lParam); - - [DllImport(@"user32.dll", EntryPoint = @"GetKeyState")] - private static extern int getKeyState(int vkey); } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 60197c62b5..0149e6c3a6 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; @@ -76,13 +77,17 @@ private void load(OsuConfigManager config) { LabelText = "Score display mode", Bindable = config.GetBindable(OsuSetting.ScoreDisplayMode) - }, - new SettingsCheckbox - { - LabelText = "Disable Win key during gameplay", - Bindable = config.GetBindable(OsuSetting.GameplayDisableWinKey) } }; + + if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) + { + Add(new SettingsCheckbox + { + LabelText = "Disable Windows key during gameplay", + Bindable = config.GetBindable(OsuSetting.GameplayDisableWinKey) + }); + } } } } From 6df1b1d9ea19bfd65be8bba837c5c8b2feff38ad Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Jul 2020 20:38:33 +0900 Subject: [PATCH 020/106] Add a background beatmap difficulty manager --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 99 +++++++++++++++++++ osu.Game/OsuGameBase.cs | 1 + 2 files changed, 100 insertions(+) create mode 100644 osu.Game/Beatmaps/BeatmapDifficultyManager.cs diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs new file mode 100644 index 0000000000..f09118a24a --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -0,0 +1,99 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Framework.Threading; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Beatmaps +{ + public class BeatmapDifficultyManager : CompositeDrawable + { + // Too many simultaneous updates can lead to stutters. One thread seems to work fine for song select display purposes. + private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(1, nameof(BeatmapDifficultyManager)); + + private readonly TimedExpiryCache difficultyCache = new TimedExpiryCache { ExpiryTime = 60000 }; + private readonly BeatmapManager beatmapManager; + + public BeatmapDifficultyManager(BeatmapManager beatmapManager) + { + this.beatmapManager = beatmapManager; + } + + public Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, + CancellationToken cancellationToken = default) + => Task.Factory.StartNew(() => GetDifficulty(beatmapInfo, rulesetInfo, mods), cancellationToken, + TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, + updateScheduler); + + public double GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null) + { + // Difficulty can only be computed if the beatmap is locally available. + if (beatmapInfo.ID == 0) + return 0; + + // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. + rulesetInfo ??= beatmapInfo.Ruleset; + + var key = new DifficultyCacheLookup(beatmapInfo, rulesetInfo, mods); + if (difficultyCache.TryGetValue(key, out var existing)) + return existing; + + try + { + var ruleset = rulesetInfo.CreateInstance(); + Debug.Assert(ruleset != null); + + var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(beatmapInfo)); + var attributes = calculator.Calculate(mods?.ToArray() ?? Array.Empty()); + + difficultyCache.Add(key, attributes.StarRating); + return attributes.StarRating; + } + catch + { + difficultyCache.Add(key, 0); + return 0; + } + } + + private readonly struct DifficultyCacheLookup : IEquatable + { + private readonly BeatmapInfo beatmapInfo; + private readonly RulesetInfo rulesetInfo; + private readonly IReadOnlyList mods; + + public DifficultyCacheLookup(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IEnumerable mods) + { + this.beatmapInfo = beatmapInfo; + this.rulesetInfo = rulesetInfo; + this.mods = mods?.OrderBy(m => m.Acronym).ToArray() ?? Array.Empty(); + } + + public bool Equals(DifficultyCacheLookup other) + => beatmapInfo.Equals(other.beatmapInfo) + && mods.SequenceEqual(other.mods); + + public override int GetHashCode() + { + var hashCode = new HashCode(); + + hashCode.Add(beatmapInfo.Hash); + hashCode.Add(rulesetInfo.GetHashCode()); + foreach (var mod in mods) + hashCode.Add(mod.Acronym); + + return hashCode.ToHashCode(); + } + } + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index dd120937af..1e6631ffa0 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -199,6 +199,7 @@ List getBeatmapScores(BeatmapSetInfo set) ScoreManager.Undelete(getBeatmapScores(item), true); }); + dependencies.Cache(new BeatmapDifficultyManager(BeatmapManager)); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore)); From 3191bb506fe41950ec8f3b25be5632782499479a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Jul 2020 21:07:14 +0900 Subject: [PATCH 021/106] Improve asynchronous process --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 83 ++++++++++++------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index f09118a24a..02342e9595 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -29,32 +29,32 @@ public BeatmapDifficultyManager(BeatmapManager beatmapManager) this.beatmapManager = beatmapManager; } - public Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, - CancellationToken cancellationToken = default) - => Task.Factory.StartNew(() => GetDifficulty(beatmapInfo, rulesetInfo, mods), cancellationToken, - TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, - updateScheduler); + public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, + CancellationToken cancellationToken = default) + { + if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) + return existing; + + return await Task.Factory.StartNew(() => getDifficulty(key), cancellationToken, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler); + } public double GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null) { - // Difficulty can only be computed if the beatmap is locally available. - if (beatmapInfo.ID == 0) - return 0; - - // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. - rulesetInfo ??= beatmapInfo.Ruleset; - - var key = new DifficultyCacheLookup(beatmapInfo, rulesetInfo, mods); - if (difficultyCache.TryGetValue(key, out var existing)) + if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; + return getDifficulty(key); + } + + private double getDifficulty(in DifficultyCacheLookup key) + { try { - var ruleset = rulesetInfo.CreateInstance(); + var ruleset = key.RulesetInfo.CreateInstance(); Debug.Assert(ruleset != null); - var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(beatmapInfo)); - var attributes = calculator.Calculate(mods?.ToArray() ?? Array.Empty()); + var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(key.BeatmapInfo)); + var attributes = calculator.Calculate(key.Mods); difficultyCache.Add(key, attributes.StarRating); return attributes.StarRating; @@ -66,30 +66,57 @@ public double GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] Rules } } + /// + /// Attempts to retrieve an existing difficulty for the combination. + /// + /// The . + /// The . + /// The s. + /// The existing difficulty value, if present. + /// The key that was used to perform this lookup. This can be further used to query . + /// Whether an existing difficulty was found. + private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IReadOnlyList mods, out double existingDifficulty, out DifficultyCacheLookup key) + { + // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. + rulesetInfo ??= beatmapInfo.Ruleset; + + // Difficulty can only be computed if the beatmap is locally available. + if (beatmapInfo.ID == 0) + { + existingDifficulty = 0; + key = default; + + return true; + } + + key = new DifficultyCacheLookup(beatmapInfo, rulesetInfo, mods); + return difficultyCache.TryGetValue(key, out existingDifficulty); + } + private readonly struct DifficultyCacheLookup : IEquatable { - private readonly BeatmapInfo beatmapInfo; - private readonly RulesetInfo rulesetInfo; - private readonly IReadOnlyList mods; + public readonly BeatmapInfo BeatmapInfo; + public readonly RulesetInfo RulesetInfo; + public readonly Mod[] Mods; public DifficultyCacheLookup(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IEnumerable mods) { - this.beatmapInfo = beatmapInfo; - this.rulesetInfo = rulesetInfo; - this.mods = mods?.OrderBy(m => m.Acronym).ToArray() ?? Array.Empty(); + BeatmapInfo = beatmapInfo; + RulesetInfo = rulesetInfo; + Mods = mods?.OrderBy(m => m.Acronym).ToArray() ?? Array.Empty(); } public bool Equals(DifficultyCacheLookup other) - => beatmapInfo.Equals(other.beatmapInfo) - && mods.SequenceEqual(other.mods); + => BeatmapInfo.Equals(other.BeatmapInfo) + && Mods.SequenceEqual(other.Mods); public override int GetHashCode() { var hashCode = new HashCode(); - hashCode.Add(beatmapInfo.Hash); - hashCode.Add(rulesetInfo.GetHashCode()); - foreach (var mod in mods) + hashCode.Add(BeatmapInfo.Hash); + hashCode.Add(RulesetInfo.GetHashCode()); + foreach (var mod in Mods) hashCode.Add(mod.Acronym); return hashCode.ToHashCode(); From 24f14751ce77a98c3a520e3b66c25df05666c0c6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Jul 2020 21:08:08 +0900 Subject: [PATCH 022/106] Update beatmap details SR on ruleset/mod changes --- .../Screens/Select/Details/AdvancedStats.cs | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 02822ea608..c5fc3701f8 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -14,10 +14,13 @@ using System.Collections.Generic; using osu.Game.Rulesets.Mods; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using osu.Framework.Threading; using osu.Framework.Utils; using osu.Game.Configuration; using osu.Game.Overlays.Settings; +using osu.Game.Rulesets; namespace osu.Game.Screens.Select.Details { @@ -26,6 +29,12 @@ public class AdvancedStats : Container [Resolved] private IBindable> mods { get; set; } + [Resolved] + private IBindable ruleset { get; set; } + + [Resolved] + private BeatmapDifficultyManager difficultyManager { get; set; } + protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate; private readonly StatisticRow starDifficulty; @@ -71,6 +80,7 @@ protected override void LoadComplete() { base.LoadComplete(); + ruleset.BindValueChanged(_ => updateStatistics()); mods.BindValueChanged(modsChanged, true); } @@ -132,11 +142,33 @@ private void updateStatistics() break; } - starDifficulty.Value = ((float)(Beatmap?.StarDifficulty ?? 0), null); - HpDrain.Value = (baseDifficulty?.DrainRate ?? 0, adjustedDifficulty?.DrainRate); Accuracy.Value = (baseDifficulty?.OverallDifficulty ?? 0, adjustedDifficulty?.OverallDifficulty); ApproachRate.Value = (baseDifficulty?.ApproachRate ?? 0, adjustedDifficulty?.ApproachRate); + + updateStarDifficulty(); + } + + private CancellationTokenSource starDifficultyCancellationSource; + + private void updateStarDifficulty() + { + starDifficultyCancellationSource?.Cancel(); + + if (Beatmap == null) + return; + + var ourSource = starDifficultyCancellationSource = new CancellationTokenSource(); + + Task.WhenAll(difficultyManager.GetDifficultyAsync(Beatmap, ruleset.Value, cancellationToken: ourSource.Token), + difficultyManager.GetDifficultyAsync(Beatmap, ruleset.Value, mods.Value, ourSource.Token)).ContinueWith(t => + { + Schedule(() => + { + if (!ourSource.IsCancellationRequested) + starDifficulty.Value = ((float)t.Result[0], (float)t.Result[1]); + }); + }, ourSource.Token); } public class StatisticRow : Container, IHasAccentColour From 9a52058a7aa5a8aa153a8793c83d77b0b1d37b3f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Jul 2020 21:08:24 +0900 Subject: [PATCH 023/106] Update carousel beatmap SR on mod/ruleset changes --- .../Carousel/DrawableCarouselBeatmap.cs | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 3e4798a812..d4205a4b93 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -3,7 +3,9 @@ using System; using System.Collections.Generic; +using System.Threading; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -13,6 +15,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -20,6 +23,8 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Graphics; @@ -41,6 +46,15 @@ public class DrawableCarouselBeatmap : DrawableCarouselItem, IHasContextMenu [Resolved(CanBeNull = true)] private BeatmapSetOverlay beatmapOverlay { get; set; } + [Resolved] + private IBindable ruleset { get; set; } + + [Resolved] + private IBindable> mods { get; set; } + + [Resolved] + private BeatmapDifficultyManager difficultyManager { get; set; } + public DrawableCarouselBeatmap(CarouselBeatmap panel) : base(panel) { @@ -137,7 +151,6 @@ private void load(BeatmapManager manager, SongSelect songSelect) }, starCounter = new StarCounter { - Current = (float)beatmap.StarDifficulty, Scale = new Vector2(0.8f), } } @@ -147,6 +160,36 @@ private void load(BeatmapManager manager, SongSelect songSelect) } } }; + + ruleset.BindValueChanged(_ => refreshStarCounter()); + mods.BindValueChanged(_ => refreshStarCounter(), true); + } + + private ScheduledDelegate scheduledRefresh; + private CancellationTokenSource cancellationSource; + + private void refreshStarCounter() + { + scheduledRefresh?.Cancel(); + scheduledRefresh = null; + + cancellationSource?.Cancel(); + cancellationSource = null; + + // Only want to run the calculation when we become visible. + scheduledRefresh = Schedule(() => + { + var ourSource = cancellationSource = new CancellationTokenSource(); + difficultyManager.GetDifficultyAsync(beatmap, ruleset.Value, mods.Value, ourSource.Token).ContinueWith(t => + { + // We're currently on a random threadpool thread which we must exit. + Schedule(() => + { + if (!ourSource.IsCancellationRequested) + starCounter.Current = (float)t.Result; + }); + }, ourSource.Token); + }); } protected override void Selected() From 939441ae408d5f4eb7ee61dba8da54e5e056d481 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Thu, 16 Jul 2020 14:50:11 +0200 Subject: [PATCH 024/106] Disable the windows key only when in gameplay. --- osu.Desktop/Windows/GameplayWinKeyHandler.cs | 14 +++++++------- osu.Game/Configuration/SessionStatics.cs | 4 +++- osu.Game/Screens/Play/ScreenSuspensionHandler.cs | 13 ++++++++++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/osu.Desktop/Windows/GameplayWinKeyHandler.cs b/osu.Desktop/Windows/GameplayWinKeyHandler.cs index 4f74a4f492..d5ef89c680 100644 --- a/osu.Desktop/Windows/GameplayWinKeyHandler.cs +++ b/osu.Desktop/Windows/GameplayWinKeyHandler.cs @@ -11,26 +11,26 @@ namespace osu.Desktop.Windows { public class GameplayWinKeyHandler : Component { - private Bindable allowScreenSuspension; private Bindable disableWinKey; + private Bindable disableWinKeySetting; private GameHost host; [BackgroundDependencyLoader] - private void load(GameHost host, OsuConfigManager config) + private void load(GameHost host, OsuConfigManager config, SessionStatics statics) { this.host = host; - allowScreenSuspension = host.AllowScreenSuspension.GetBoundCopy(); - allowScreenSuspension.ValueChanged += toggleWinKey; + disableWinKey = statics.GetBindable(Static.DisableWindowsKey); + disableWinKey.ValueChanged += toggleWinKey; - disableWinKey = config.GetBindable(OsuSetting.GameplayDisableWinKey); - disableWinKey.BindValueChanged(t => allowScreenSuspension.TriggerChange(), true); + disableWinKeySetting = config.GetBindable(OsuSetting.GameplayDisableWinKey); + disableWinKeySetting.BindValueChanged(t => disableWinKey.TriggerChange(), true); } private void toggleWinKey(ValueChangedEvent e) { - if (!e.NewValue && disableWinKey.Value) + if (e.NewValue && disableWinKeySetting.Value) host.InputThread.Scheduler.Add(WindowsKey.Disable); else host.InputThread.Scheduler.Add(WindowsKey.Enable); diff --git a/osu.Game/Configuration/SessionStatics.cs b/osu.Game/Configuration/SessionStatics.cs index 40b2adb867..7aad79b5ad 100644 --- a/osu.Game/Configuration/SessionStatics.cs +++ b/osu.Game/Configuration/SessionStatics.cs @@ -12,12 +12,14 @@ protected override void InitialiseDefaults() { Set(Static.LoginOverlayDisplayed, false); Set(Static.MutedAudioNotificationShownOnce, false); + Set(Static.DisableWindowsKey, false); } } public enum Static { LoginOverlayDisplayed, - MutedAudioNotificationShownOnce + MutedAudioNotificationShownOnce, + DisableWindowsKey } } diff --git a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs index 8585a5c309..c2c7f1ac41 100644 --- a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs +++ b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs @@ -8,6 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Platform; +using osu.Game.Configuration; namespace osu.Game.Screens.Play { @@ -22,6 +23,9 @@ public class ScreenSuspensionHandler : Component [Resolved] private GameHost host { get; set; } + [Resolved] + private SessionStatics statics { get; set; } + public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer) { this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer)); @@ -36,7 +40,11 @@ protected override void LoadComplete() Debug.Assert(host.AllowScreenSuspension.Value); isPaused = gameplayClockContainer.IsPaused.GetBoundCopy(); - isPaused.BindValueChanged(paused => host.AllowScreenSuspension.Value = paused.NewValue, true); + isPaused.BindValueChanged(paused => + { + host.AllowScreenSuspension.Value = paused.NewValue; + statics.Set(Static.DisableWindowsKey, !paused.NewValue); + }, true); } protected override void Dispose(bool isDisposing) @@ -46,7 +54,10 @@ protected override void Dispose(bool isDisposing) isPaused?.UnbindAll(); if (host != null) + { host.AllowScreenSuspension.Value = true; + statics.Set(Static.DisableWindowsKey, false); + } } } } From 396ada7f39fb52a3301398c1cf8d17767da86bf6 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Thu, 16 Jul 2020 15:03:25 +0200 Subject: [PATCH 025/106] Enable windows key when a replay is loaded. --- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/ScreenSuspensionHandler.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 541275cf55..e0721d55f7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -181,7 +181,7 @@ private void load(AudioManager audio, OsuConfigManager config) InternalChild = GameplayClockContainer = new GameplayClockContainer(Beatmap.Value, Mods.Value, DrawableRuleset.GameplayStartTime); AddInternal(gameplayBeatmap = new GameplayBeatmap(playableBeatmap)); - AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer)); + AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer, DrawableRuleset.HasReplayLoaded)); dependencies.CacheAs(gameplayBeatmap); diff --git a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs index c2c7f1ac41..6865db5a5e 100644 --- a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs +++ b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs @@ -19,6 +19,7 @@ public class ScreenSuspensionHandler : Component { private readonly GameplayClockContainer gameplayClockContainer; private Bindable isPaused; + private readonly Bindable hasReplayLoaded; [Resolved] private GameHost host { get; set; } @@ -26,9 +27,10 @@ public class ScreenSuspensionHandler : Component [Resolved] private SessionStatics statics { get; set; } - public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer) + public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer, Bindable hasReplayLoaded) { this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer)); + this.hasReplayLoaded = hasReplayLoaded.GetBoundCopy(); } protected override void LoadComplete() @@ -43,8 +45,9 @@ protected override void LoadComplete() isPaused.BindValueChanged(paused => { host.AllowScreenSuspension.Value = paused.NewValue; - statics.Set(Static.DisableWindowsKey, !paused.NewValue); + statics.Set(Static.DisableWindowsKey, !paused.NewValue && !hasReplayLoaded.Value); }, true); + hasReplayLoaded.BindValueChanged(_ => isPaused.TriggerChange(), true); } protected override void Dispose(bool isDisposing) @@ -52,6 +55,7 @@ protected override void Dispose(bool isDisposing) base.Dispose(isDisposing); isPaused?.UnbindAll(); + hasReplayLoaded.UnbindAll(); if (host != null) { From 8147e67f5337b9bfe6d29cbfc7a6c8bcb0015f7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Jul 2020 11:53:04 +0900 Subject: [PATCH 026/106] Use static instances in all fallback ControlPoint lookups to reduce allocations --- .../ControlPoints/ControlPointInfo.cs | 16 ++++++------- .../ControlPoints/DifficultyControlPoint.cs | 5 ++++ .../ControlPoints/EffectControlPoint.cs | 6 +++++ .../ControlPoints/TimingControlPoint.cs | 12 ++++++++++ .../Containers/BeatSyncedContainer.cs | 23 ++----------------- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index af6ca24165..49f1052248 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -64,14 +64,14 @@ public class ControlPointInfo /// /// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearchWithFallback(DifficultyPoints, time); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearchWithFallback(DifficultyPoints, time, DifficultyControlPoint.DEFAULT); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearchWithFallback(EffectPoints, time); + public EffectControlPoint EffectPointAt(double time) => binarySearchWithFallback(EffectPoints, time, EffectControlPoint.DEFAULT); /// /// Finds the sound control point that is active at . @@ -92,21 +92,21 @@ public class ControlPointInfo /// [JsonIgnore] public double BPMMaximum => - 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? TimingControlPoint.DEFAULT).BeatLength; /// /// Finds the minimum BPM represented by any timing control point. /// [JsonIgnore] public double BPMMinimum => - 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? TimingControlPoint.DEFAULT).BeatLength; /// /// Finds the mode BPM (most common BPM) represented by the control points. /// [JsonIgnore] public double BPMMode => - 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? TimingControlPoint.DEFAULT).BeatLength; /// /// Remove all s and return to a pristine state. @@ -170,12 +170,12 @@ public void RemoveGroup(ControlPointGroup group) /// /// The list to search. /// The time to find the control point at. - /// The control point to use when is before any control points. If null, a new control point will be constructed. + /// The control point to use when is before any control points. /// The active control point at , or a fallback if none found. - private T binarySearchWithFallback(IReadOnlyList list, double time, T prePoint = null) + private T binarySearchWithFallback(IReadOnlyList list, double time, T fallback) where T : ControlPoint, new() { - return binarySearch(list, time) ?? prePoint ?? new T(); + return binarySearch(list, time) ?? fallback; } /// diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index 2448b2b25c..1d38790f87 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -7,6 +7,11 @@ namespace osu.Game.Beatmaps.ControlPoints { public class DifficultyControlPoint : ControlPoint { + public static readonly DifficultyControlPoint DEFAULT = new DifficultyControlPoint + { + SpeedMultiplierBindable = { Disabled = true }, + }; + /// /// The speed multiplier at this control point. /// diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 9b69147468..9e8e3978be 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -7,6 +7,12 @@ namespace osu.Game.Beatmaps.ControlPoints { public class EffectControlPoint : ControlPoint { + public static readonly EffectControlPoint DEFAULT = new EffectControlPoint + { + KiaiModeBindable = { Disabled = true }, + OmitFirstBarLineBindable = { Disabled = true } + }; + /// /// Whether the first bar line of this control point is ignored. /// diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 1927dd6575..c3a32c4410 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -13,6 +13,18 @@ public class TimingControlPoint : ControlPoint /// public readonly Bindable TimeSignatureBindable = new Bindable(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple }; + /// + /// Default length of a beat in milliseconds. Used whenever there is no beatmap or track playing. + /// + private const double default_beat_length = 60000.0 / 60.0; + + public static readonly TimingControlPoint DEFAULT = new TimingControlPoint + { + BeatLength = default_beat_length, + BeatLengthBindable = { Disabled = true }, + TimeSignatureBindable = { Disabled = true } + }; + /// /// The time signature at this control point. /// diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index dd5c41285a..df063f57d5 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -43,14 +43,6 @@ public class BeatSyncedContainer : Container /// public double MinimumBeatLength { get; set; } - /// - /// Default length of a beat in milliseconds. Used whenever there is no beatmap or track playing. - /// - private const double default_beat_length = 60000.0 / 60.0; - - private TimingControlPoint defaultTiming; - private EffectControlPoint defaultEffect; - protected bool IsBeatSyncedWithTrack { get; private set; } protected override void Update() @@ -81,8 +73,8 @@ protected override void Update() if (timingPoint == null || !IsBeatSyncedWithTrack) { currentTrackTime = Clock.CurrentTime; - timingPoint = defaultTiming; - effectPoint = defaultEffect; + timingPoint = TimingControlPoint.DEFAULT; + effectPoint = EffectControlPoint.DEFAULT; } double beatLength = timingPoint.BeatLength / Divisor; @@ -116,17 +108,6 @@ protected override void Update() private void load(IBindable beatmap) { Beatmap.BindTo(beatmap); - - defaultTiming = new TimingControlPoint - { - BeatLength = default_beat_length, - }; - - defaultEffect = new EffectControlPoint - { - KiaiMode = false, - OmitFirstBarLine = false - }; } protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) From 2f16b448ea8619ea6ea8d34231ff94f040702e53 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Jul 2020 12:03:49 +0900 Subject: [PATCH 027/106] Set beatLength inline --- osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index c3a32c4410..9345299c3a 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -20,8 +20,11 @@ public class TimingControlPoint : ControlPoint public static readonly TimingControlPoint DEFAULT = new TimingControlPoint { - BeatLength = default_beat_length, - BeatLengthBindable = { Disabled = true }, + BeatLengthBindable = + { + Value = default_beat_length, + Disabled = true + }, TimeSignatureBindable = { Disabled = true } }; From 7250bc351d3068ed767d73cf67a663135119da65 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Jul 2020 12:06:41 +0900 Subject: [PATCH 028/106] Remove unnecessary new() specification --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 49f1052248..55a04e5ee8 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -173,7 +173,7 @@ public void RemoveGroup(ControlPointGroup group) /// The control point to use when is before any control points. /// The active control point at , or a fallback if none found. private T binarySearchWithFallback(IReadOnlyList list, double time, T fallback) - where T : ControlPoint, new() + where T : ControlPoint { return binarySearch(list, time) ?? fallback; } From 81d95f8584b21f8b656ab522107a130acbe29941 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 18 Jul 2020 20:24:38 +0300 Subject: [PATCH 029/106] Implement UserBrickPanel component --- .../Visual/Online/TestSceneSocialOverlay.cs | 84 ------ .../Visual/Online/TestSceneUserPanel.cs | 13 + .../Dashboard/Friends/FriendDisplay.cs | 3 + .../OverlayPanelDisplayStyleControl.cs | 7 +- .../Sections/General/LoginSettings.cs | 2 +- osu.Game/Overlays/SocialOverlay.cs | 242 ------------------ osu.Game/Users/ExtendedUserPanel.cs | 148 +++++++++++ osu.Game/Users/UserBrickPanel.cs | 65 +++++ osu.Game/Users/UserGridPanel.cs | 2 +- osu.Game/Users/UserListPanel.cs | 2 +- osu.Game/Users/UserPanel.cs | 130 +--------- 11 files changed, 241 insertions(+), 457 deletions(-) delete mode 100644 osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs delete mode 100644 osu.Game/Overlays/SocialOverlay.cs create mode 100644 osu.Game/Users/ExtendedUserPanel.cs create mode 100644 osu.Game/Users/UserBrickPanel.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs deleted file mode 100644 index 77e77d90c1..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using NUnit.Framework; -using osu.Game.Overlays; -using osu.Game.Users; - -namespace osu.Game.Tests.Visual.Online -{ - [TestFixture] - public class TestSceneSocialOverlay : OsuTestScene - { - protected override bool UseOnlineAPI => true; - - public TestSceneSocialOverlay() - { - SocialOverlay s = new SocialOverlay - { - Users = new[] - { - new User - { - Username = @"flyte", - Id = 3103765, - Country = new Country { FlagName = @"JP" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", - }, - new User - { - Username = @"Cookiezi", - Id = 124493, - Country = new Country { FlagName = @"KR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg", - }, - new User - { - Username = @"Angelsim", - Id = 1777162, - Country = new Country { FlagName = @"KR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", - }, - new User - { - Username = @"Rafis", - Id = 2558286, - Country = new Country { FlagName = @"PL" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg", - }, - new User - { - Username = @"hvick225", - Id = 50265, - Country = new Country { FlagName = @"TW" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c5.jpg", - }, - new User - { - Username = @"peppy", - Id = 2, - Country = new Country { FlagName = @"AU" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" - }, - new User - { - Username = @"filsdelama", - Id = 2831793, - Country = new Country { FlagName = @"FR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c7.jpg" - }, - new User - { - Username = @"_index", - Id = 652457, - Country = new Country { FlagName = @"RU" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c8.jpg" - }, - }, - }; - Add(s); - - AddStep(@"toggle", s.ToggleVisibility); - } - } -} diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index f763e50067..c2e9945c99 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -42,6 +42,19 @@ public void SetUp() => Schedule(() => Spacing = new Vector2(10f), Children = new Drawable[] { + new UserBrickPanel(new User + { + Username = @"flyte", + Id = 3103765, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" + }), + new UserBrickPanel(new User + { + Username = @"peppy", + Id = 2, + Colour = "99EB47", + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", + }), flyte = new UserGridPanel(new User { Username = @"flyte", diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs index 79fda99c73..41b25ee1a5 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs @@ -225,6 +225,9 @@ private UserPanel createUserPanel(User user, OverlayPanelDisplayStyle style) case OverlayPanelDisplayStyle.List: return new UserListPanel(user); + + case OverlayPanelDisplayStyle.Brick: + return new UserBrickPanel(user); } } diff --git a/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs b/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs index 7269007b41..87b9d89d4d 100644 --- a/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs +++ b/osu.Game/Overlays/OverlayPanelDisplayStyleControl.cs @@ -34,6 +34,10 @@ public OverlayPanelDisplayStyleControl() { Icon = FontAwesome.Solid.Bars }); + AddTabItem(new PanelDisplayTabItem(OverlayPanelDisplayStyle.Brick) + { + Icon = FontAwesome.Solid.Th + }); } protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer @@ -96,6 +100,7 @@ protected override void OnHoverLost(HoverLostEvent e) public enum OverlayPanelDisplayStyle { Card, - List + List, + Brick } } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 52b712a40e..34e5da4ef4 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -33,7 +33,7 @@ public class LoginSettings : FillFlowContainer, IOnlineComponent [Resolved] private OsuColour colours { get; set; } - private UserPanel panel; + private UserGridPanel panel; private UserDropdown dropdown; /// diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs deleted file mode 100644 index 1b05142192..0000000000 --- a/osu.Game/Overlays/SocialOverlay.cs +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Bindables; -using osuTK; -using osuTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Overlays.SearchableList; -using osu.Game.Overlays.Social; -using osu.Game.Users; -using System.Threading; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Threading; - -namespace osu.Game.Overlays -{ - public class SocialOverlay : SearchableListOverlay - { - private readonly LoadingSpinner loading; - private FillFlowContainer panels; - - protected override Color4 BackgroundColour => Color4Extensions.FromHex(@"60284b"); - protected override Color4 TrianglesColourLight => Color4Extensions.FromHex(@"672b51"); - protected override Color4 TrianglesColourDark => Color4Extensions.FromHex(@"5c2648"); - - protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); - - private User[] users = Array.Empty(); - - public User[] Users - { - get => users; - set - { - if (users == value) - return; - - users = value ?? Array.Empty(); - - if (LoadState >= LoadState.Ready) - recreatePanels(); - } - } - - public SocialOverlay() - : base(OverlayColourScheme.Pink) - { - Add(loading = new LoadingSpinner()); - - Filter.Search.Current.ValueChanged += text => - { - if (!string.IsNullOrEmpty(text.NewValue)) - { - // force searching in players until searching for friends is supported - Header.Tabs.Current.Value = SocialTab.AllPlayers; - - if (Filter.Tabs.Current.Value != SocialSortCriteria.Rank) - Filter.Tabs.Current.Value = SocialSortCriteria.Rank; - } - }; - - Header.Tabs.Current.ValueChanged += _ => queueUpdate(); - Filter.Tabs.Current.ValueChanged += _ => onFilterUpdate(); - - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += _ => recreatePanels(); - Filter.Dropdown.Current.ValueChanged += _ => recreatePanels(); - - currentQuery.BindTo(Filter.Search.Current); - currentQuery.ValueChanged += query => - { - queryChangedDebounce?.Cancel(); - - if (string.IsNullOrEmpty(query.NewValue)) - queueUpdate(); - else - queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); - }; - } - - [BackgroundDependencyLoader] - private void load() - { - recreatePanels(); - } - - private APIRequest getUsersRequest; - - private readonly Bindable currentQuery = new Bindable(); - - private ScheduledDelegate queryChangedDebounce; - - private void queueUpdate() => Scheduler.AddOnce(updateSearch); - - private CancellationTokenSource loadCancellation; - - private void updateSearch() - { - queryChangedDebounce?.Cancel(); - - if (!IsLoaded) - return; - - Users = null; - clearPanels(); - getUsersRequest?.Cancel(); - - if (API?.IsLoggedIn != true) - return; - - switch (Header.Tabs.Current.Value) - { - case SocialTab.Friends: - var friendRequest = new GetFriendsRequest(); // TODO filter arguments? - friendRequest.Success += users => Users = users.ToArray(); - API.Queue(getUsersRequest = friendRequest); - break; - - default: - var userRequest = new GetUsersRequest(); // TODO filter arguments! - userRequest.Success += res => Users = res.Users.Select(r => r.User).ToArray(); - API.Queue(getUsersRequest = userRequest); - break; - } - } - - private void recreatePanels() - { - clearPanels(); - - if (Users == null) - { - loading.Hide(); - return; - } - - IEnumerable sortedUsers = Users; - - switch (Filter.Tabs.Current.Value) - { - case SocialSortCriteria.Location: - sortedUsers = sortedUsers.OrderBy(u => u.Country.FullName); - break; - - case SocialSortCriteria.Name: - sortedUsers = sortedUsers.OrderBy(u => u.Username); - break; - } - - if (Filter.Dropdown.Current.Value == SortDirection.Descending) - sortedUsers = sortedUsers.Reverse(); - - var newPanels = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(10f), - Margin = new MarginPadding { Top = 10 }, - ChildrenEnumerable = sortedUsers.Select(u => - { - UserPanel panel; - - switch (Filter.DisplayStyleControl.DisplayStyle.Value) - { - case PanelDisplayStyle.Grid: - panel = new UserGridPanel(u) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Width = 290, - }; - break; - - default: - panel = new UserListPanel(u); - break; - } - - panel.Status.BindTo(u.Status); - panel.Activity.BindTo(u.Activity); - return panel; - }) - }; - - LoadComponentAsync(newPanels, f => - { - if (panels != null) - ScrollFlow.Remove(panels); - - loading.Hide(); - ScrollFlow.Add(panels = newPanels); - }, (loadCancellation = new CancellationTokenSource()).Token); - } - - private void onFilterUpdate() - { - if (Filter.Tabs.Current.Value == SocialSortCriteria.Rank) - { - queueUpdate(); - return; - } - - recreatePanels(); - } - - private void clearPanels() - { - loading.Show(); - - loadCancellation?.Cancel(); - - if (panels != null) - { - panels.Expire(); - panels = null; - } - } - - public override void APIStateChanged(IAPIProvider api, APIState state) - { - switch (state) - { - case APIState.Online: - queueUpdate(); - break; - - default: - Users = null; - clearPanels(); - break; - } - } - } -} diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs new file mode 100644 index 0000000000..5bd98b3fb7 --- /dev/null +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -0,0 +1,148 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osuTK; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics.Sprites; +using osu.Game.Users.Drawables; +using osu.Framework.Input.Events; + +namespace osu.Game.Users +{ + public abstract class ExtendedUserPanel : UserPanel + { + public readonly Bindable Status = new Bindable(); + + public readonly IBindable Activity = new Bindable(); + + protected TextFlowContainer LastVisitMessage { get; private set; } + + private SpriteIcon statusIcon; + private OsuSpriteText statusMessage; + + public ExtendedUserPanel(User user) + : base(user) + { + } + + [BackgroundDependencyLoader] + private void load() + { + BorderColour = ColourProvider?.Light1 ?? Colours.GreyVioletLighter; + + Status.ValueChanged += status => displayStatus(status.NewValue, Activity.Value); + Activity.ValueChanged += activity => displayStatus(Status.Value, activity.NewValue); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Status.TriggerChange(); + + // Colour should be applied immediately on first load. + statusIcon.FinishTransforms(); + } + + protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar + { + User = User, + OpenOnClick = { Value = false } + }; + + protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.Country) + { + Size = new Vector2(39, 26) + }; + + protected SpriteIcon CreateStatusIcon() => statusIcon = new SpriteIcon + { + Icon = FontAwesome.Regular.Circle, + Size = new Vector2(25) + }; + + protected FillFlowContainer CreateStatusMessage(bool rightAlignedChildren) + { + var statusContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical + }; + + var alignment = rightAlignedChildren ? Anchor.CentreRight : Anchor.CentreLeft; + + statusContainer.Add(LastVisitMessage = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)).With(text => + { + text.Anchor = alignment; + text.Origin = alignment; + text.AutoSizeAxes = Axes.Both; + text.Alpha = 0; + + if (User.LastVisit.HasValue) + { + text.AddText(@"Last seen "); + text.AddText(new DrawableDate(User.LastVisit.Value, italic: false) + { + Shadow = false + }); + } + })); + + statusContainer.Add(statusMessage = new OsuSpriteText + { + Anchor = alignment, + Origin = alignment, + Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold) + }); + + return statusContainer; + } + + private void displayStatus(UserStatus status, UserActivity activity = null) + { + if (status != null) + { + LastVisitMessage.FadeTo(status is UserStatusOffline && User.LastVisit.HasValue ? 1 : 0); + + // Set status message based on activity (if we have one) and status is not offline + if (activity != null && !(status is UserStatusOffline)) + { + statusMessage.Text = activity.Status; + statusIcon.FadeColour(activity.GetAppropriateColour(Colours), 500, Easing.OutQuint); + return; + } + + // Otherwise use only status + statusMessage.Text = status.Message; + statusIcon.FadeColour(status.GetAppropriateColour(Colours), 500, Easing.OutQuint); + + return; + } + + // Fallback to web status if local one is null + if (User.IsOnline) + { + Status.Value = new UserStatusOnline(); + return; + } + + Status.Value = new UserStatusOffline(); + } + + protected override bool OnHover(HoverEvent e) + { + BorderThickness = 2; + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + BorderThickness = 0; + base.OnHoverLost(e); + } + } +} diff --git a/osu.Game/Users/UserBrickPanel.cs b/osu.Game/Users/UserBrickPanel.cs new file mode 100644 index 0000000000..f6eabc3b75 --- /dev/null +++ b/osu.Game/Users/UserBrickPanel.cs @@ -0,0 +1,65 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osuTK; + +namespace osu.Game.Users +{ + public class UserBrickPanel : UserPanel + { + public UserBrickPanel(User user) + : base(user) + { + AutoSizeAxes = Axes.X; + Height = 23; + CornerRadius = 6; + } + + [BackgroundDependencyLoader] + private void load() + { + Background.FadeTo(0.3f); + } + + protected override Drawable CreateLayout() => new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5, 0), + Margin = new MarginPadding + { + Horizontal = 5 + }, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new CircularContainer + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Masking = true, + Width = 4, + Height = 13, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = string.IsNullOrEmpty(User.Colour) ? Color4Extensions.FromHex("0087ca") : Color4Extensions.FromHex(User.Colour) + } + }, + CreateUsername().With(u => + { + u.Anchor = Anchor.CentreLeft; + u.Origin = Anchor.CentreLeft; + u.Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold); + }) + } + }; + } +} diff --git a/osu.Game/Users/UserGridPanel.cs b/osu.Game/Users/UserGridPanel.cs index e62a834d6d..44dcbc305d 100644 --- a/osu.Game/Users/UserGridPanel.cs +++ b/osu.Game/Users/UserGridPanel.cs @@ -9,7 +9,7 @@ namespace osu.Game.Users { - public class UserGridPanel : UserPanel + public class UserGridPanel : ExtendedUserPanel { private const int margin = 10; diff --git a/osu.Game/Users/UserListPanel.cs b/osu.Game/Users/UserListPanel.cs index 1c3ae20577..9c95eff739 100644 --- a/osu.Game/Users/UserListPanel.cs +++ b/osu.Game/Users/UserListPanel.cs @@ -12,7 +12,7 @@ namespace osu.Game.Users { - public class UserListPanel : UserPanel + public class UserListPanel : ExtendedUserPanel { public UserListPanel(User user) : base(user) diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 6f59f9e443..94c0c31cfc 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -2,9 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osuTK; using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -14,11 +12,8 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Containers; -using osu.Game.Users.Drawables; using JetBrains.Annotations; -using osu.Framework.Input.Events; namespace osu.Game.Users { @@ -26,21 +21,12 @@ public abstract class UserPanel : OsuClickableContainer, IHasContextMenu { public readonly User User; - public readonly Bindable Status = new Bindable(); - - public readonly IBindable Activity = new Bindable(); - public new Action Action; protected Action ViewProfile { get; private set; } protected DelayedLoadUnloadWrapper Background { get; private set; } - protected TextFlowContainer LastVisitMessage { get; private set; } - - private SpriteIcon statusIcon; - private OsuSpriteText statusMessage; - protected UserPanel(User user) { if (user == null) @@ -53,23 +39,22 @@ protected UserPanel(User user) private UserProfileOverlay profileOverlay { get; set; } [Resolved(canBeNull: true)] - private OverlayColourProvider colourProvider { get; set; } + protected OverlayColourProvider ColourProvider { get; private set; } [Resolved] - private OsuColour colours { get; set; } + protected OsuColour Colours { get; private set; } [BackgroundDependencyLoader] private void load() { Masking = true; - BorderColour = colourProvider?.Light1 ?? colours.GreyVioletLighter; AddRange(new[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = colourProvider?.Background5 ?? colours.Gray1 + Colour = ColourProvider?.Background5 ?? Colours.Gray1 }, Background = new DelayedLoadUnloadWrapper(() => new UserCoverBackground { @@ -86,9 +71,6 @@ private void load() CreateLayout() }); - Status.ValueChanged += status => displayStatus(status.NewValue, Activity.Value); - Activity.ValueChanged += activity => displayStatus(Status.Value, activity.NewValue); - base.Action = ViewProfile = () => { Action?.Invoke(); @@ -96,41 +78,9 @@ private void load() }; } - protected override void LoadComplete() - { - base.LoadComplete(); - Status.TriggerChange(); - - // Colour should be applied immediately on first load. - statusIcon.FinishTransforms(); - } - - protected override bool OnHover(HoverEvent e) - { - BorderThickness = 2; - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - BorderThickness = 0; - base.OnHoverLost(e); - } - [NotNull] protected abstract Drawable CreateLayout(); - protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar - { - User = User, - OpenOnClick = { Value = false } - }; - - protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.Country) - { - Size = new Vector2(39, 26) - }; - protected OsuSpriteText CreateUsername() => new OsuSpriteText { Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold), @@ -138,80 +88,6 @@ protected override void OnHoverLost(HoverLostEvent e) Text = User.Username, }; - protected SpriteIcon CreateStatusIcon() => statusIcon = new SpriteIcon - { - Icon = FontAwesome.Regular.Circle, - Size = new Vector2(25) - }; - - protected FillFlowContainer CreateStatusMessage(bool rightAlignedChildren) - { - var statusContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical - }; - - var alignment = rightAlignedChildren ? Anchor.CentreRight : Anchor.CentreLeft; - - statusContainer.Add(LastVisitMessage = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)).With(text => - { - text.Anchor = alignment; - text.Origin = alignment; - text.AutoSizeAxes = Axes.Both; - text.Alpha = 0; - - if (User.LastVisit.HasValue) - { - text.AddText(@"Last seen "); - text.AddText(new DrawableDate(User.LastVisit.Value, italic: false) - { - Shadow = false - }); - } - })); - - statusContainer.Add(statusMessage = new OsuSpriteText - { - Anchor = alignment, - Origin = alignment, - Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold) - }); - - return statusContainer; - } - - private void displayStatus(UserStatus status, UserActivity activity = null) - { - if (status != null) - { - LastVisitMessage.FadeTo(status is UserStatusOffline && User.LastVisit.HasValue ? 1 : 0); - - // Set status message based on activity (if we have one) and status is not offline - if (activity != null && !(status is UserStatusOffline)) - { - statusMessage.Text = activity.Status; - statusIcon.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint); - return; - } - - // Otherwise use only status - statusMessage.Text = status.Message; - statusIcon.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint); - - return; - } - - // Fallback to web status if local one is null - if (User.IsOnline) - { - Status.Value = new UserStatusOnline(); - return; - } - - Status.Value = new UserStatusOffline(); - } - public MenuItem[] ContextMenuItems => new MenuItem[] { new OsuMenuItem("View Profile", MenuItemType.Highlighted, ViewProfile), From 753b1f3401757cb6cd71b1cece3b2499a59f1328 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 18 Jul 2020 20:26:15 +0300 Subject: [PATCH 030/106] Make ctor protected --- osu.Game/Users/ExtendedUserPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index 5bd98b3fb7..2604815751 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -25,7 +25,7 @@ public abstract class ExtendedUserPanel : UserPanel private SpriteIcon statusIcon; private OsuSpriteText statusMessage; - public ExtendedUserPanel(User user) + protected ExtendedUserPanel(User user) : base(user) { } From 3e773fde27d165bd43558ba48d5685c3568d5a26 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 18 Jul 2020 23:15:22 +0300 Subject: [PATCH 031/106] Remove SocialOverlay component as never being used --- .../Visual/Online/TestSceneSocialOverlay.cs | 84 ------ osu.Game/Overlays/SocialOverlay.cs | 242 ------------------ 2 files changed, 326 deletions(-) delete mode 100644 osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs delete mode 100644 osu.Game/Overlays/SocialOverlay.cs diff --git a/osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs deleted file mode 100644 index 77e77d90c1..0000000000 --- a/osu.Game.Tests/Visual/Online/TestSceneSocialOverlay.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using NUnit.Framework; -using osu.Game.Overlays; -using osu.Game.Users; - -namespace osu.Game.Tests.Visual.Online -{ - [TestFixture] - public class TestSceneSocialOverlay : OsuTestScene - { - protected override bool UseOnlineAPI => true; - - public TestSceneSocialOverlay() - { - SocialOverlay s = new SocialOverlay - { - Users = new[] - { - new User - { - Username = @"flyte", - Id = 3103765, - Country = new Country { FlagName = @"JP" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", - }, - new User - { - Username = @"Cookiezi", - Id = 124493, - Country = new Country { FlagName = @"KR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg", - }, - new User - { - Username = @"Angelsim", - Id = 1777162, - Country = new Country { FlagName = @"KR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", - }, - new User - { - Username = @"Rafis", - Id = 2558286, - Country = new Country { FlagName = @"PL" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg", - }, - new User - { - Username = @"hvick225", - Id = 50265, - Country = new Country { FlagName = @"TW" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c5.jpg", - }, - new User - { - Username = @"peppy", - Id = 2, - Country = new Country { FlagName = @"AU" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" - }, - new User - { - Username = @"filsdelama", - Id = 2831793, - Country = new Country { FlagName = @"FR" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c7.jpg" - }, - new User - { - Username = @"_index", - Id = 652457, - Country = new Country { FlagName = @"RU" }, - CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c8.jpg" - }, - }, - }; - Add(s); - - AddStep(@"toggle", s.ToggleVisibility); - } - } -} diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs deleted file mode 100644 index 1b05142192..0000000000 --- a/osu.Game/Overlays/SocialOverlay.cs +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Bindables; -using osuTK; -using osuTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Overlays.SearchableList; -using osu.Game.Overlays.Social; -using osu.Game.Users; -using System.Threading; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Threading; - -namespace osu.Game.Overlays -{ - public class SocialOverlay : SearchableListOverlay - { - private readonly LoadingSpinner loading; - private FillFlowContainer panels; - - protected override Color4 BackgroundColour => Color4Extensions.FromHex(@"60284b"); - protected override Color4 TrianglesColourLight => Color4Extensions.FromHex(@"672b51"); - protected override Color4 TrianglesColourDark => Color4Extensions.FromHex(@"5c2648"); - - protected override SearchableListHeader CreateHeader() => new Header(); - protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); - - private User[] users = Array.Empty(); - - public User[] Users - { - get => users; - set - { - if (users == value) - return; - - users = value ?? Array.Empty(); - - if (LoadState >= LoadState.Ready) - recreatePanels(); - } - } - - public SocialOverlay() - : base(OverlayColourScheme.Pink) - { - Add(loading = new LoadingSpinner()); - - Filter.Search.Current.ValueChanged += text => - { - if (!string.IsNullOrEmpty(text.NewValue)) - { - // force searching in players until searching for friends is supported - Header.Tabs.Current.Value = SocialTab.AllPlayers; - - if (Filter.Tabs.Current.Value != SocialSortCriteria.Rank) - Filter.Tabs.Current.Value = SocialSortCriteria.Rank; - } - }; - - Header.Tabs.Current.ValueChanged += _ => queueUpdate(); - Filter.Tabs.Current.ValueChanged += _ => onFilterUpdate(); - - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += _ => recreatePanels(); - Filter.Dropdown.Current.ValueChanged += _ => recreatePanels(); - - currentQuery.BindTo(Filter.Search.Current); - currentQuery.ValueChanged += query => - { - queryChangedDebounce?.Cancel(); - - if (string.IsNullOrEmpty(query.NewValue)) - queueUpdate(); - else - queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); - }; - } - - [BackgroundDependencyLoader] - private void load() - { - recreatePanels(); - } - - private APIRequest getUsersRequest; - - private readonly Bindable currentQuery = new Bindable(); - - private ScheduledDelegate queryChangedDebounce; - - private void queueUpdate() => Scheduler.AddOnce(updateSearch); - - private CancellationTokenSource loadCancellation; - - private void updateSearch() - { - queryChangedDebounce?.Cancel(); - - if (!IsLoaded) - return; - - Users = null; - clearPanels(); - getUsersRequest?.Cancel(); - - if (API?.IsLoggedIn != true) - return; - - switch (Header.Tabs.Current.Value) - { - case SocialTab.Friends: - var friendRequest = new GetFriendsRequest(); // TODO filter arguments? - friendRequest.Success += users => Users = users.ToArray(); - API.Queue(getUsersRequest = friendRequest); - break; - - default: - var userRequest = new GetUsersRequest(); // TODO filter arguments! - userRequest.Success += res => Users = res.Users.Select(r => r.User).ToArray(); - API.Queue(getUsersRequest = userRequest); - break; - } - } - - private void recreatePanels() - { - clearPanels(); - - if (Users == null) - { - loading.Hide(); - return; - } - - IEnumerable sortedUsers = Users; - - switch (Filter.Tabs.Current.Value) - { - case SocialSortCriteria.Location: - sortedUsers = sortedUsers.OrderBy(u => u.Country.FullName); - break; - - case SocialSortCriteria.Name: - sortedUsers = sortedUsers.OrderBy(u => u.Username); - break; - } - - if (Filter.Dropdown.Current.Value == SortDirection.Descending) - sortedUsers = sortedUsers.Reverse(); - - var newPanels = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(10f), - Margin = new MarginPadding { Top = 10 }, - ChildrenEnumerable = sortedUsers.Select(u => - { - UserPanel panel; - - switch (Filter.DisplayStyleControl.DisplayStyle.Value) - { - case PanelDisplayStyle.Grid: - panel = new UserGridPanel(u) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Width = 290, - }; - break; - - default: - panel = new UserListPanel(u); - break; - } - - panel.Status.BindTo(u.Status); - panel.Activity.BindTo(u.Activity); - return panel; - }) - }; - - LoadComponentAsync(newPanels, f => - { - if (panels != null) - ScrollFlow.Remove(panels); - - loading.Hide(); - ScrollFlow.Add(panels = newPanels); - }, (loadCancellation = new CancellationTokenSource()).Token); - } - - private void onFilterUpdate() - { - if (Filter.Tabs.Current.Value == SocialSortCriteria.Rank) - { - queueUpdate(); - return; - } - - recreatePanels(); - } - - private void clearPanels() - { - loading.Show(); - - loadCancellation?.Cancel(); - - if (panels != null) - { - panels.Expire(); - panels = null; - } - } - - public override void APIStateChanged(IAPIProvider api, APIState state) - { - switch (state) - { - case APIState.Online: - queueUpdate(); - break; - - default: - Users = null; - clearPanels(); - break; - } - } - } -} From a6562be3eb33d35ac6b47a2d19cdaee3f6cc52dd Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sat, 18 Jul 2020 23:27:33 +0300 Subject: [PATCH 032/106] Remove unused classes from social namespace --- osu.Game/Overlays/Social/FilterControl.cs | 33 ----------- osu.Game/Overlays/Social/Header.cs | 67 ----------------------- 2 files changed, 100 deletions(-) delete mode 100644 osu.Game/Overlays/Social/FilterControl.cs delete mode 100644 osu.Game/Overlays/Social/Header.cs diff --git a/osu.Game/Overlays/Social/FilterControl.cs b/osu.Game/Overlays/Social/FilterControl.cs deleted file mode 100644 index 93fcc3c401..0000000000 --- a/osu.Game/Overlays/Social/FilterControl.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Extensions.Color4Extensions; -using osuTK.Graphics; -using osu.Framework.Graphics; -using osu.Game.Overlays.SearchableList; - -namespace osu.Game.Overlays.Social -{ - public class FilterControl : SearchableListFilterControl - { - protected override Color4 BackgroundColour => Color4Extensions.FromHex(@"47253a"); - protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Rank; - protected override SortDirection DefaultCategory => SortDirection.Ascending; - - public FilterControl() - { - Tabs.Margin = new MarginPadding { Top = 10 }; - } - } - - public enum SocialSortCriteria - { - Rank, - Name, - Location, - //[Description("Time Zone")] - //TimeZone, - //[Description("World Map")] - //WorldMap, - } -} diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs deleted file mode 100644 index 22e0fdcd56..0000000000 --- a/osu.Game/Overlays/Social/Header.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Overlays.SearchableList; -using osuTK.Graphics; -using osu.Framework.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osu.Framework.Allocation; -using System.ComponentModel; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics.Sprites; - -namespace osu.Game.Overlays.Social -{ - public class Header : SearchableListHeader - { - private OsuSpriteText browser; - - protected override Color4 BackgroundColour => Color4Extensions.FromHex(@"38202e"); - - protected override SocialTab DefaultTab => SocialTab.AllPlayers; - protected override IconUsage Icon => FontAwesome.Solid.Users; - - protected override Drawable CreateHeaderText() - { - return new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = "social ", - Font = OsuFont.GetFont(size: 25), - }, - browser = new OsuSpriteText - { - Text = "browser", - Font = OsuFont.GetFont(size: 25, weight: FontWeight.Light), - }, - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - browser.Colour = colours.Pink; - } - } - - public enum SocialTab - { - [Description("All Players")] - AllPlayers, - - [Description("Friends")] - Friends, - //[Description("Team Members")] - //TeamMembers, - //[Description("Chat Channels")] - //ChatChannels, - } -} From 2025e5418c841a386ba5599164c3c9d017c7814c Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Sun, 19 Jul 2020 04:10:35 +0300 Subject: [PATCH 033/106] Minor visual adjustments --- osu.Game/Users/UserBrickPanel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Users/UserBrickPanel.cs b/osu.Game/Users/UserBrickPanel.cs index f6eabc3b75..9ca7768187 100644 --- a/osu.Game/Users/UserBrickPanel.cs +++ b/osu.Game/Users/UserBrickPanel.cs @@ -16,15 +16,14 @@ public class UserBrickPanel : UserPanel public UserBrickPanel(User user) : base(user) { - AutoSizeAxes = Axes.X; - Height = 23; + AutoSizeAxes = Axes.Both; CornerRadius = 6; } [BackgroundDependencyLoader] private void load() { - Background.FadeTo(0.3f); + Background.FadeTo(0.2f); } protected override Drawable CreateLayout() => new FillFlowContainer @@ -34,7 +33,8 @@ private void load() Spacing = new Vector2(5, 0), Margin = new MarginPadding { - Horizontal = 5 + Horizontal = 10, + Vertical = 3, }, Anchor = Anchor.Centre, Origin = Anchor.Centre, From 648e414c14ac0ade2821b91b7101f225a3b8a65f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jul 2020 11:04:33 +0900 Subject: [PATCH 034/106] Update InputHandlers in line with framework changes --- .../Replays/CatchFramedReplayInputHandler.cs | 15 ++++++--------- .../Replays/ManiaFramedReplayInputHandler.cs | 5 ++++- .../Replays/OsuFramedReplayInputHandler.cs | 12 ++++++------ .../Replays/TaikoFramedReplayInputHandler.cs | 5 ++++- .../Visual/Gameplay/TestSceneReplayRecorder.cs | 15 +++------------ .../Visual/Gameplay/TestSceneReplayRecording.cs | 15 +++------------ .../Rulesets/Replays/FramedReplayInputHandler.cs | 3 --- 7 files changed, 26 insertions(+), 44 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs index f122588a2b..24c21fbc84 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs @@ -35,18 +35,15 @@ protected float? Position } } - public override List GetPendingInputs() + public override void GetPendingInputs(List input) { - if (!Position.HasValue) return new List(); + if (!Position.HasValue) return; - return new List + input.Add(new CatchReplayState { - new CatchReplayState - { - PressedActions = CurrentFrame?.Actions ?? new List(), - CatcherX = Position.Value - }, - }; + PressedActions = CurrentFrame?.Actions ?? new List(), + CatcherX = Position.Value + }); } public class CatchReplayState : ReplayState diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs index 899718b77e..26c4ccf289 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs @@ -18,6 +18,9 @@ public ManiaFramedReplayInputHandler(Replay replay) protected override bool IsImportant(ManiaReplayFrame frame) => frame.Actions.Any(); - public override List GetPendingInputs() => new List { new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() } }; + public override void GetPendingInputs(List input) + { + input.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); + } } } diff --git a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs index b42e9ac187..5c803539c2 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs @@ -36,19 +36,19 @@ protected Vector2? Position } } - public override List GetPendingInputs() + public override void GetPendingInputs(List input) { - return new List - { + input.Add( new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(Position ?? Vector2.Zero) - }, + }); + input.Add( new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() - } - }; + }); + ; } } } diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs index 97337acc45..7361d4efa8 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -18,6 +18,9 @@ public TaikoFramedReplayInputHandler(Replay replay) protected override bool IsImportant(TaikoReplayFrame frame) => frame.Actions.Any(); - public override List GetPendingInputs() => new List { new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() } }; + public override void GetPendingInputs(List input) + { + input.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); + } } } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs index c7455583e4..e473f49826 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs @@ -173,19 +173,10 @@ public TestFramedReplayInputHandler(Replay replay) { } - public override List GetPendingInputs() + public override void GetPendingInputs(List inputs) { - return new List - { - new MousePositionAbsoluteInput - { - Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) - }, - new ReplayState - { - PressedActions = CurrentFrame?.Actions ?? new List() - } - }; + inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) }); + inputs.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); } } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs index 7822f07957..e891ed617a 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs @@ -113,19 +113,10 @@ public TestFramedReplayInputHandler(Replay replay) { } - public override List GetPendingInputs() + public override void GetPendingInputs(List inputs) { - return new List - { - new MousePositionAbsoluteInput - { - Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) - }, - new ReplayState - { - PressedActions = CurrentFrame?.Actions ?? new List() - } - }; + inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) }); + inputs.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); } } diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index 55d82c4083..cf5c88b8fd 100644 --- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using JetBrains.Annotations; -using osu.Framework.Input.StateChanges; using osu.Game.Input.Handlers; using osu.Game.Replays; @@ -69,8 +68,6 @@ private bool advanceFrame() return true; } - public override List GetPendingInputs() => new List(); - private const double sixty_frame_time = 1000.0 / 60; protected virtual double AllowedImportantTimeSpan => sixty_frame_time * 1.2; From 72ace508b605dace2f6f3e684aa83fac3bae3c4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jul 2020 11:37:10 +0900 Subject: [PATCH 035/106] Reduce memory allocations in MenuCursorContainer --- osu.Game/Graphics/Cursor/MenuCursorContainer.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs index b7ea1ba56a..02bfb3fad6 100644 --- a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; @@ -55,7 +54,15 @@ protected override void Update() return; } - var newTarget = inputManager.HoveredDrawables.OfType().FirstOrDefault(t => t.ProvidingUserCursor) ?? this; + IProvideCursor newTarget = this; + + foreach (var d in inputManager.HoveredDrawables) + { + if (!(d is IProvideCursor p) || !p.ProvidingUserCursor) continue; + + newTarget = p; + break; + } if (currentTarget == newTarget) return; From a7fcce0bf719a68fda8d5cb4abad429d72828699 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jul 2020 11:37:38 +0900 Subject: [PATCH 036/106] Fix hard crash on notifications firing before NotificationOverlay is ready --- osu.Game/OsuGame.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 618049e72c..f4bb10340e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -63,7 +63,8 @@ public class OsuGame : OsuGameBase, IKeyBindingHandler private ChannelManager channelManager; - private NotificationOverlay notifications; + [NotNull] + private readonly NotificationOverlay notifications = new NotificationOverlay(); private NowPlayingOverlay nowPlaying; @@ -82,7 +83,7 @@ public class OsuGame : OsuGameBase, IKeyBindingHandler public virtual Storage GetStorageForStableInstall() => null; - public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight; + public float ToolbarOffset => (Toolbar?.Position.Y ?? 0) + (Toolbar?.DrawHeight ?? 0); private IdleTracker idleTracker; @@ -250,7 +251,7 @@ public void HandleLink(LinkDetails link) => Schedule(() => case LinkAction.OpenEditorTimestamp: case LinkAction.JoinMultiplayerMatch: case LinkAction.Spectate: - waitForReady(() => notifications, _ => notifications?.Post(new SimpleNotification + waitForReady(() => notifications, _ => notifications.Post(new SimpleNotification { Text = @"This link type is not yet supported!", Icon = FontAwesome.Solid.LifeRing, @@ -536,14 +537,14 @@ protected override void LoadComplete() MenuCursorContainer.CanShowCursor = menuScreen?.CursorVisible ?? false; // todo: all archive managers should be able to be looped here. - SkinManager.PostNotification = n => notifications?.Post(n); + SkinManager.PostNotification = n => notifications.Post(n); SkinManager.GetStableStorage = GetStorageForStableInstall; - BeatmapManager.PostNotification = n => notifications?.Post(n); + BeatmapManager.PostNotification = n => notifications.Post(n); BeatmapManager.GetStableStorage = GetStorageForStableInstall; BeatmapManager.PresentImport = items => PresentBeatmap(items.First()); - ScoreManager.PostNotification = n => notifications?.Post(n); + ScoreManager.PostNotification = n => notifications.Post(n); ScoreManager.GetStableStorage = GetStorageForStableInstall; ScoreManager.PresentImport = items => PresentScore(items.First()); @@ -615,12 +616,12 @@ protected override void LoadComplete() loadComponentSingleFile(MusicController = new MusicController(), Add, true); - loadComponentSingleFile(notifications = new NotificationOverlay + loadComponentSingleFile(notifications.With(d => { - GetToolbarHeight = () => ToolbarOffset, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - }, rightFloatingOverlayContent.Add, true); + d.GetToolbarHeight = () => ToolbarOffset; + d.Anchor = Anchor.TopRight; + d.Origin = Anchor.TopRight; + }), rightFloatingOverlayContent.Add, true); loadComponentSingleFile(screenshotManager, Add); From 3823bd8343d7ae3a8e8281ce154cdd6a05031e09 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 19 Jul 2020 14:11:21 +0900 Subject: [PATCH 037/106] Add back missing default implementations for lookup functions --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 4 ++-- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 55a04e5ee8..e7788b75f3 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -78,14 +78,14 @@ public class ControlPointInfo /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearchWithFallback(SamplePoints, time, SamplePoints.Count > 0 ? SamplePoints[0] : null); + public SampleControlPoint SamplePointAt(double time) => binarySearchWithFallback(SamplePoints, time, SamplePoints.Count > 0 ? SamplePoints[0] : SampleControlPoint.DEFAULT); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearchWithFallback(TimingPoints, time, TimingPoints.Count > 0 ? TimingPoints[0] : null); + public TimingControlPoint TimingPointAt(double time) => binarySearchWithFallback(TimingPoints, time, TimingPoints.Count > 0 ? TimingPoints[0] : TimingControlPoint.DEFAULT); /// /// Finds the maximum BPM represented by any timing control point. diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 61851a00d7..c052c04ea0 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -10,6 +10,12 @@ public class SampleControlPoint : ControlPoint { public const string DEFAULT_BANK = "normal"; + public static readonly SampleControlPoint DEFAULT = new SampleControlPoint + { + SampleBankBindable = { Disabled = true }, + SampleVolumeBindable = { Disabled = true } + }; + /// /// The default sample bank at this control point. /// From 55d921ef85629cd0b04687497793336abfda88aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jul 2020 15:19:17 +0900 Subject: [PATCH 038/106] Improve feel of animation --- .../TestSceneSpinner.cs | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 32 ++++++++++++------- .../Drawables/Pieces/SpinnerBackground.cs | 10 +++--- .../Objects/Drawables/Pieces/SpinnerTicks.cs | 8 ++--- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs index 8cb7f3f4b6..67afc45e32 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinner.cs @@ -36,7 +36,7 @@ public TestSceneSpinner() private void testSingle(float circleSize, bool auto = false) { - var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 }; + var spinner = new Spinner { StartTime = Time.Current + 2000, EndTime = Time.Current + 5000 }; spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize }); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index be6766509c..3dd98be6fb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -93,7 +93,7 @@ public DrawableSpinner(Spinner s) { Background = new SpinnerBackground { - Alpha = 0.6f, + Alpha = 1f, Anchor = Anchor.Centre, Origin = Anchor.Centre, }, @@ -128,7 +128,7 @@ private void load(OsuColour colours) Background.AccentColour = normalColour; - completeColour = colours.YellowLight.Opacity(0.75f); + completeColour = colours.YellowLight; Disc.AccentColour = fillColour; circle.Colour = colours.BlueDark; @@ -152,8 +152,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) Disc.FadeAccent(completeColour, duration); - Background.FadeAccent(completeColour, duration); - Background.FadeOut(duration); + Background.FadeAccent(completeColour.Darken(1), duration); circle.FadeColour(completeColour, duration); glow.FadeColour(completeColour, duration); @@ -204,14 +203,25 @@ protected override void UpdateInitialTransforms() { base.UpdateInitialTransforms(); - circleContainer.ScaleTo(Spinner.Scale * 0.3f); - circleContainer.ScaleTo(Spinner.Scale, HitObject.TimePreempt / 1.4f, Easing.OutQuint); + circleContainer.ScaleTo(0); + mainContainer.ScaleTo(0); - mainContainer - .ScaleTo(0) - .ScaleTo(Spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, HitObject.TimePreempt - 150, Easing.OutQuint) - .Then() - .ScaleTo(1, 500, Easing.OutQuint); + using (BeginDelayedSequence(HitObject.TimePreempt / 2, true)) + { + float phaseOneScale = Spinner.Scale * 0.8f; + + circleContainer.ScaleTo(phaseOneScale, HitObject.TimePreempt / 2f, Easing.OutQuint); + + mainContainer + .ScaleTo(phaseOneScale * circle.DrawHeight / DrawHeight * 1.4f, HitObject.TimePreempt / 2, Easing.OutElasticHalf) + .RotateTo(25, HitObject.TimePreempt + Spinner.Duration); + + using (BeginDelayedSequence(HitObject.TimePreempt / 2, true)) + { + circleContainer.ScaleTo(Spinner.Scale * 1.4f, 400, Easing.OutQuint); + mainContainer.ScaleTo(Spinner.Scale, 400, Easing.OutQuint); + } + } } protected override void UpdateStateTransforms(ArmedState state) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 77228e28af..bfb9a9e763 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -1,25 +1,25 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : CircularContainer, IHasAccentColour { - protected Box Disc; + private readonly Box disc; public Color4 AccentColour { - get => Disc.Colour; + get => disc.Colour; set { - Disc.Colour = value; + disc.Colour = value; EdgeEffect = new EdgeEffectParameters { @@ -38,7 +38,7 @@ public SpinnerBackground() Children = new Drawable[] { - Disc = new Box + disc = new Box { Origin = Anchor.Centre, Anchor = Anchor.Centre, diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs index 676cefb236..0e7dafdbea 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs @@ -20,24 +20,24 @@ public SpinnerTicks() Anchor = Anchor.Centre; RelativeSizeAxes = Axes.Both; - const float count = 18; + const float count = 8; for (float i = 0; i < count; i++) { Add(new Container { Colour = Color4.Black, - Alpha = 0.4f, + Alpha = 0.2f, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, - Radius = 10, + Radius = 20, Colour = Color4.Gray.Opacity(0.2f), }, RelativePositionAxes = Axes.Both, Masking = true, CornerRadius = 5, - Size = new Vector2(60, 10), + Size = new Vector2(65, 10), Origin = Anchor.Centre, Position = new Vector2( 0.5f + MathF.Sin(i / count * 2 * MathF.PI) / 2 * 0.86f, From 33e58bb7db992e24562ecf38774b09297b6b55cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jul 2020 17:22:17 +0900 Subject: [PATCH 039/106] Fix sizing and colour not correct on hit --- .../Objects/Drawables/DrawableSpinner.cs | 55 +++++++++++-------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 3dd98be6fb..b8a290a978 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -147,15 +147,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (Progress >= 1 && !Disc.Complete) { Disc.Complete = true; - - const float duration = 200; - - Disc.FadeAccent(completeColour, duration); - - Background.FadeAccent(completeColour.Darken(1), duration); - - circle.FadeColour(completeColour, duration); - glow.FadeColour(completeColour, duration); + transformFillColour(completeColour, 200); } if (userTriggered || Time.Current < Spinner.EndTime) @@ -208,18 +200,18 @@ protected override void UpdateInitialTransforms() using (BeginDelayedSequence(HitObject.TimePreempt / 2, true)) { - float phaseOneScale = Spinner.Scale * 0.8f; + float phaseOneScale = Spinner.Scale * 0.7f; - circleContainer.ScaleTo(phaseOneScale, HitObject.TimePreempt / 2f, Easing.OutQuint); + circleContainer.ScaleTo(phaseOneScale, HitObject.TimePreempt / 4, Easing.OutQuint); mainContainer - .ScaleTo(phaseOneScale * circle.DrawHeight / DrawHeight * 1.4f, HitObject.TimePreempt / 2, Easing.OutElasticHalf) - .RotateTo(25, HitObject.TimePreempt + Spinner.Duration); + .ScaleTo(phaseOneScale * circle.DrawHeight / DrawHeight * 1.5f, HitObject.TimePreempt / 4, Easing.OutQuint) + .RotateTo((float)(25 * Spinner.Duration / 2000), HitObject.TimePreempt + Spinner.Duration); using (BeginDelayedSequence(HitObject.TimePreempt / 2, true)) { - circleContainer.ScaleTo(Spinner.Scale * 1.4f, 400, Easing.OutQuint); - mainContainer.ScaleTo(Spinner.Scale, 400, Easing.OutQuint); + circleContainer.ScaleTo(Spinner.Scale, 400, Easing.OutQuint); + mainContainer.ScaleTo(1, 400, Easing.OutQuint); } } } @@ -228,18 +220,33 @@ protected override void UpdateStateTransforms(ArmedState state) { base.UpdateStateTransforms(state); - var sequence = this.Delay(Spinner.Duration).FadeOut(160); - - switch (state) + using (BeginDelayedSequence(Spinner.Duration, true)) { - case ArmedState.Hit: - sequence.ScaleTo(Scale * 1.2f, 320, Easing.Out); - break; + this.FadeOut(160); - case ArmedState.Miss: - sequence.ScaleTo(Scale * 0.8f, 320, Easing.In); - break; + switch (state) + { + case ArmedState.Hit: + transformFillColour(completeColour, 0); + this.ScaleTo(Scale * 1.2f, 320, Easing.Out); + mainContainer.RotateTo(mainContainer.Rotation + 180, 320); + break; + + case ArmedState.Miss: + this.ScaleTo(Scale * 0.8f, 320, Easing.In); + break; + } } } + + private void transformFillColour(Colour4 colour, double duration) + { + Disc.FadeAccent(colour, duration); + + Background.FadeAccent(colour.Darken(1), duration); + + circle.FadeColour(colour, duration); + glow.FadeColour(colour, duration); + } } } From 4cbc176cb66c3c9616ccc613252c7eee20d9a97f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jul 2020 17:48:35 +0900 Subject: [PATCH 040/106] Add less fill and more transparency --- .../Objects/Drawables/DrawableSpinner.cs | 10 ++++-- .../Drawables/Pieces/SpinnerBackground.cs | 8 ++--- .../Objects/Drawables/Pieces/SpinnerTicks.cs | 34 ++++++++++++++----- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index b8a290a978..fafb3ab69d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -93,7 +93,10 @@ public DrawableSpinner(Spinner s) { Background = new SpinnerBackground { - Alpha = 1f, + Disc = + { + Alpha = 0f, + }, Anchor = Anchor.Centre, Origin = Anchor.Centre, }, @@ -125,10 +128,10 @@ public DrawableSpinner(Spinner s) private void load(OsuColour colours) { normalColour = baseColour; + completeColour = colours.YellowLight; Background.AccentColour = normalColour; - - completeColour = colours.YellowLight; + Ticks.AccentColour = normalColour; Disc.AccentColour = fillColour; circle.Colour = colours.BlueDark; @@ -244,6 +247,7 @@ private void transformFillColour(Colour4 colour, double duration) Disc.FadeAccent(colour, duration); Background.FadeAccent(colour.Darken(1), duration); + Ticks.FadeAccent(colour, duration); circle.FadeColour(colour, duration); glow.FadeColour(colour, duration); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index bfb9a9e763..944354abca 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -12,14 +12,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : CircularContainer, IHasAccentColour { - private readonly Box disc; + public readonly Box Disc; public Color4 AccentColour { - get => disc.Colour; + get => Disc.Colour; set { - disc.Colour = value; + Disc.Colour = value; EdgeEffect = new EdgeEffectParameters { @@ -38,7 +38,7 @@ public SpinnerBackground() Children = new Drawable[] { - disc = new Box + Disc = new Box { Origin = Anchor.Centre, Anchor = Anchor.Centre, diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs index 0e7dafdbea..95bccbf2fc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -9,10 +10,11 @@ using osuTK; using osuTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { - public class SpinnerTicks : Container + public class SpinnerTicks : Container, IHasAccentColour { public SpinnerTicks() { @@ -26,14 +28,8 @@ public SpinnerTicks() { Add(new Container { - Colour = Color4.Black, - Alpha = 0.2f, - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Glow, - Radius = 20, - Colour = Color4.Gray.Opacity(0.2f), - }, + Alpha = 0.4f, + Blending = BlendingParameters.Additive, RelativePositionAxes = Axes.Both, Masking = true, CornerRadius = 5, @@ -54,5 +50,25 @@ public SpinnerTicks() }); } } + + public Color4 AccentColour + { + get => Colour; + set + { + Colour = value; + + foreach (var c in Children.OfType()) + { + c.EdgeEffect = + new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Radius = 20, + Colour = value.Opacity(0.8f), + }; + } + } + } } } From e06d3c5812e87037b94a756b1bba98cdcaf09d87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Jul 2020 17:52:59 +0900 Subject: [PATCH 041/106] Minor adjustments to tick clearance --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerTicks.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index fafb3ab69d..9c4608cbb1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -208,7 +208,7 @@ protected override void UpdateInitialTransforms() circleContainer.ScaleTo(phaseOneScale, HitObject.TimePreempt / 4, Easing.OutQuint); mainContainer - .ScaleTo(phaseOneScale * circle.DrawHeight / DrawHeight * 1.5f, HitObject.TimePreempt / 4, Easing.OutQuint) + .ScaleTo(phaseOneScale * circle.DrawHeight / DrawHeight * 1.6f, HitObject.TimePreempt / 4, Easing.OutQuint) .RotateTo((float)(25 * Spinner.Duration / 2000), HitObject.TimePreempt + Spinner.Duration); using (BeginDelayedSequence(HitObject.TimePreempt / 2, true)) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs index 95bccbf2fc..ba7e8eae6f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerTicks.cs @@ -33,11 +33,11 @@ public SpinnerTicks() RelativePositionAxes = Axes.Both, Masking = true, CornerRadius = 5, - Size = new Vector2(65, 10), + Size = new Vector2(60, 10), Origin = Anchor.Centre, Position = new Vector2( - 0.5f + MathF.Sin(i / count * 2 * MathF.PI) / 2 * 0.86f, - 0.5f + MathF.Cos(i / count * 2 * MathF.PI) / 2 * 0.86f + 0.5f + MathF.Sin(i / count * 2 * MathF.PI) / 2 * 0.83f, + 0.5f + MathF.Cos(i / count * 2 * MathF.PI) / 2 * 0.83f ), Rotation = -i / count * 360 + 90, Children = new[] From f044c06d089319841abc78a59c68096fd0a5a330 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 20 Jul 2020 22:26:58 +0900 Subject: [PATCH 042/106] Fix hold notes accepting presses during release lenience --- .../TestSceneHoldNoteInput.cs | 65 +++++++++++++++++-- .../Objects/Drawables/DrawableHoldNote.cs | 6 ++ 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs index 0d13b85901..95072cf4f8 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteInput.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -10,6 +11,8 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Replays; +using osu.Game.Rulesets.Mania.Scoring; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -236,6 +239,53 @@ public void TestPressAndReleaseAtTail() assertTailJudgement(HitResult.Meh); } + [Test] + public void TestMissReleaseAndHitSecondRelease() + { + var windows = new ManiaHitWindows(); + windows.SetDifficulty(10); + + var beatmap = new Beatmap + { + HitObjects = + { + new HoldNote + { + StartTime = 1000, + Duration = 500, + Column = 0, + }, + new HoldNote + { + StartTime = 1000 + 500 + windows.WindowFor(HitResult.Miss) + 10, + Duration = 500, + Column = 0, + }, + }, + BeatmapInfo = + { + BaseDifficulty = new BeatmapDifficulty + { + SliderTickRate = 4, + OverallDifficulty = 10, + }, + Ruleset = new ManiaRuleset().RulesetInfo + }, + }; + + performTest(new List + { + new ManiaReplayFrame(beatmap.HitObjects[1].StartTime, ManiaAction.Key1), + new ManiaReplayFrame(beatmap.HitObjects[1].GetEndTime()), + }, beatmap); + + AddAssert("first hold note missed", () => judgementResults.Where(j => beatmap.HitObjects[0].NestedHitObjects.Contains(j.HitObject)) + .All(j => j.Type == HitResult.Miss)); + + AddAssert("second hold note missed", () => judgementResults.Where(j => beatmap.HitObjects[1].NestedHitObjects.Contains(j.HitObject)) + .All(j => j.Type == HitResult.Perfect)); + } + private void assertHeadJudgement(HitResult result) => AddAssert($"head judged as {result}", () => judgementResults[0].Type == result); @@ -250,11 +300,11 @@ private void assertTickJudgement(HitResult result) private ScoreAccessibleReplayPlayer currentPlayer; - private void performTest(List frames) + private void performTest(List frames, Beatmap beatmap = null) { - AddStep("load player", () => + if (beatmap == null) { - Beatmap.Value = CreateWorkingBeatmap(new Beatmap + beatmap = new Beatmap { HitObjects = { @@ -270,9 +320,14 @@ private void performTest(List frames) BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 4 }, Ruleset = new ManiaRuleset().RulesetInfo }, - }); + }; - Beatmap.Value.Beatmap.ControlPointInfo.Add(0, new DifficultyControlPoint { SpeedMultiplier = 0.1f }); + beatmap.ControlPointInfo.Add(0, new DifficultyControlPoint { SpeedMultiplier = 0.1f }); + } + + AddStep("load player", () => + { + Beatmap.Value = CreateWorkingBeatmap(beatmap); var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }); diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 2262bd2b7d..0c5289efe1 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -167,6 +167,12 @@ public bool OnPressed(ManiaAction action) if (action != Action.Value) return false; + // The tail has a lenience applied to it which is factored into the miss window (i.e. the miss judgement will be delayed). + // But the hold cannot ever be started within the late-lenience window, so we should skip trying to begin the hold during that time. + // Note: Unlike below, we use the tail's start time to determine the time offset. + if (Time.Current > Tail.HitObject.StartTime && !Tail.HitObject.HitWindows.CanBeHit(Time.Current - Tail.HitObject.StartTime)) + return false; + beginHoldAt(Time.Current - Head.HitObject.StartTime); Head.UpdateResult(); From 72722d4c721c304a8119e56a496a0d05173cfa20 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2020 17:18:26 +0000 Subject: [PATCH 043/106] Bump Microsoft.Build.Traversal from 2.0.50 to 2.0.52 Bumps [Microsoft.Build.Traversal](https://github.com/Microsoft/MSBuildSdks) from 2.0.50 to 2.0.52. - [Release notes](https://github.com/Microsoft/MSBuildSdks/releases) - [Changelog](https://github.com/microsoft/MSBuildSdks/blob/master/RELEASE.md) - [Commits](https://github.com/Microsoft/MSBuildSdks/compare/Microsoft.Build.Traversal.2.0.50...Microsoft.Build.Traversal.2.0.52) Signed-off-by: dependabot-preview[bot] --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 9aa5b6192b..233a040d18 100644 --- a/global.json +++ b/global.json @@ -5,6 +5,6 @@ "version": "3.1.100" }, "msbuild-sdks": { - "Microsoft.Build.Traversal": "2.0.50" + "Microsoft.Build.Traversal": "2.0.52" } } \ No newline at end of file From f71ed47e6693f59c0bba83433d83d0f43c876833 Mon Sep 17 00:00:00 2001 From: Joehu Date: Mon, 20 Jul 2020 11:52:02 -0700 Subject: [PATCH 044/106] Fix focused textbox absorbing input when unfocused --- osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 8977f014b6..f77a3109c9 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -67,6 +67,8 @@ protected override bool OnKeyDown(KeyDownEvent e) public bool OnPressed(GlobalAction action) { + if (!HasFocus) return false; + if (action == GlobalAction.Back) { if (Text.Length > 0) From f48984920d5b489adba4afd4a8c3c9fedaceebe1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 11:21:32 +0900 Subject: [PATCH 045/106] Change bonus volume logic to work --- .../Objects/Drawables/DrawableSpinnerTick.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 6512a9526e..436994e480 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Audio; -using osu.Framework.Bindables; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; @@ -10,8 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { - private readonly BindableDouble bonusSampleVolume = new BindableDouble(); - private bool hasBonusPoints; /// @@ -25,8 +21,7 @@ internal set { hasBonusPoints = value; - bonusSampleVolume.Value = value ? 1 : 0; - ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints = value; + Samples.Volume.Value = ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints ? 1 : 0; } } @@ -37,13 +32,6 @@ public DrawableSpinnerTick(SpinnerTick spinnerTick) { } - protected override void LoadComplete() - { - base.LoadComplete(); - - Samples.AddAdjustment(AdjustableProperty.Volume, bonusSampleVolume); - } - /// /// Apply a judgement result. /// From 4dd40542d519ad2f5db5a529ec864b990a0ec697 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 11:21:58 +0900 Subject: [PATCH 046/106] Rename rotation set method to match others --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerBonusComponent.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index b82b44f35b..2707453ab9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -227,7 +227,7 @@ protected override void UpdateAfterChildren() Ticks.Rotation = Disc.Rotation; SpmCounter.SetRotation(Disc.CumulativeRotation); - bonusComponent.UpdateRotation(Disc.CumulativeRotation); + bonusComponent.SetRotation(Disc.CumulativeRotation); float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; float targetScale = relativeCircleScale + (1 - relativeCircleScale) * Progress; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs index 5c96751b3a..c49c10b45c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs @@ -40,7 +40,7 @@ public SpinnerBonusComponent(DrawableSpinner drawableSpinner, Container Date: Tue, 21 Jul 2020 06:59:24 +0300 Subject: [PATCH 047/106] Fix spinner bonus ticks samples not actually playing --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 436994e480..d49766adda 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -21,7 +21,8 @@ internal set { hasBonusPoints = value; - Samples.Volume.Value = ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints ? 1 : 0; + ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints = value; + Samples.Volume.Value = value ? 1 : 0; } } From c1442568b95548316e748e470c00c70a45bd5f9a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 17:04:29 +0900 Subject: [PATCH 048/106] Make perfect mod ignore all non-combo-affecting hitobjects --- .../Mods/TestSceneCatchModPerfect.cs | 2 +- osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs | 6 ------ .../Skinning/TestSceneDrawableTaikoMascot.cs | 2 +- osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs | 4 ++-- .../Judgements/TaikoDrumRollJudgement.cs | 2 -- osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs | 2 -- osu.Game/Rulesets/Mods/ModPerfect.cs | 1 + 7 files changed, 5 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs index 3e06e78dba..c1b7214d72 100644 --- a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs +++ b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModPerfect.cs @@ -50,7 +50,7 @@ public void TestJuiceStream(bool shouldMiss) public void TestDroplet(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Droplet { StartTime = 1000 }), shouldMiss); // We only care about testing misses, hits are tested via JuiceStream - [TestCase(true)] + [TestCase(false)] public void TestTinyDroplet(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new TinyDroplet { StartTime = 1000 }), shouldMiss); } } diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs b/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs index e3391c47f1..fb92399102 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModPerfect.cs @@ -1,17 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Rulesets.Catch.Judgements; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Mods { public class CatchModPerfect : ModPerfect { - protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) - => !(result.Judgement is CatchBananaJudgement) - && base.FailCondition(healthProcessor, result); } } diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs index d200c44a02..cb6a0decde 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs @@ -111,7 +111,7 @@ public void TestMissState() assertStateAfterResult(new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Great }, TaikoMascotAnimationState.Idle); assertStateAfterResult(new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Miss }, TaikoMascotAnimationState.Fail); - assertStateAfterResult(new JudgementResult(new DrumRoll(), new TaikoDrumRollJudgement()) { Type = HitResult.Great }, TaikoMascotAnimationState.Fail); + assertStateAfterResult(new JudgementResult(new DrumRoll(), new TaikoDrumRollJudgement()) { Type = HitResult.Great }, TaikoMascotAnimationState.Idle); assertStateAfterResult(new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Good }, TaikoMascotAnimationState.Idle); } diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs index aaa634648a..0be005e1c4 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs @@ -36,7 +36,7 @@ protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => }; [Test] - public void TestSpinnerDoesNotFail() + public void TestSpinnerDoesFail() { bool judged = false; AddStep("Setup judgements", () => @@ -45,7 +45,7 @@ public void TestSpinnerDoesNotFail() Player.ScoreProcessor.NewJudgement += b => judged = true; }); AddUntilStep("swell judged", () => judged); - AddAssert("not failed", () => !Player.HasFailed); + AddAssert("failed", () => Player.HasFailed); } } } diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs index 604daa929f..0d91002f4b 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs @@ -7,8 +7,6 @@ namespace osu.Game.Rulesets.Taiko.Judgements { public class TaikoDrumRollJudgement : TaikoJudgement { - public override bool AffectsCombo => false; - protected override double HealthIncreaseFor(HitResult result) { // Drum rolls can be ignored with no health penalty diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs index 29be5e0eac..4d61efd3ee 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs @@ -7,8 +7,6 @@ namespace osu.Game.Rulesets.Taiko.Judgements { public class TaikoSwellJudgement : TaikoJudgement { - public override bool AffectsCombo => false; - protected override double HealthIncreaseFor(HitResult result) { switch (result) diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs index 7fe606d584..65f1a972ed 100644 --- a/osu.Game/Rulesets/Mods/ModPerfect.cs +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -17,6 +17,7 @@ public abstract class ModPerfect : ModSuddenDeath protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) => !(result.Judgement is IgnoreJudgement) + && result.Judgement.AffectsCombo && result.Type != result.Judgement.MaxResult; } } From 05102bc1baf00b4508bf57dfe0e749569944b8ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 18:22:37 +0900 Subject: [PATCH 049/106] Split ticks up into bonus and non-bonus --- .../Judgements/OsuSpinnerTickJudgement.cs | 18 -------------- .../Objects/Drawables/DrawableSpinner.cs | 3 +++ .../Drawables/DrawableSpinnerBonusTick.cs | 13 ++++++++++ .../Objects/Drawables/DrawableSpinnerTick.cs | 19 --------------- .../Drawables/Pieces/SpinnerBonusComponent.cs | 5 +--- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 19 ++++++++++----- .../Objects/SpinnerBonusTick.cs | 24 +++++++++++++++++++ osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs | 15 +++++++----- 8 files changed, 63 insertions(+), 53 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs create mode 100644 osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs deleted file mode 100644 index f9cac7a2c1..0000000000 --- a/osu.Game.Rulesets.Osu/Judgements/OsuSpinnerTickJudgement.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Rulesets.Scoring; - -namespace osu.Game.Rulesets.Osu.Judgements -{ - public class OsuSpinnerTickJudgement : OsuJudgement - { - internal bool HasBonusPoints; - - public override bool AffectsCombo => false; - - protected override int NumericResultFor(HitResult result) => 100 + (HasBonusPoints ? 1000 : 0); - - protected override double HealthIncreaseFor(HitResult result) => 0; - } -} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 2707453ab9..531d16d1d1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -157,6 +157,9 @@ protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject) { switch (hitObject) { + case SpinnerBonusTick bonusTick: + return new DrawableSpinnerBonusTick(bonusTick); + case SpinnerTick tick: return new DrawableSpinnerTick(tick); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs new file mode 100644 index 0000000000..2e1c07c4c6 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerBonusTick.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Osu.Objects.Drawables +{ + public class DrawableSpinnerBonusTick : DrawableSpinnerTick + { + public DrawableSpinnerBonusTick(SpinnerBonusTick spinnerTick) + : base(spinnerTick) + { + } + } +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index d49766adda..5fb7653f5a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -1,31 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { - private bool hasBonusPoints; - - /// - /// Whether this judgement has a bonus of 1,000 points additional to the numeric result. - /// Set when a spin occured after the spinner has completed. - /// - public bool HasBonusPoints - { - get => hasBonusPoints; - internal set - { - hasBonusPoints = value; - - ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints = value; - Samples.Volume.Value = value ? 1 : 0; - } - } - public override bool DisplayResult => false; public DrawableSpinnerTick(SpinnerTick spinnerTick) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs index c49c10b45c..9a65247453 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs @@ -55,12 +55,9 @@ public void SetRotation(double rotation) var tick = ticks[currentSpins]; if (direction >= 0) - { - tick.HasBonusPoints = currentSpins > spinsRequired; tick.TriggerResult(true); - } - if (tick.HasBonusPoints) + if (tick is DrawableSpinnerBonusTick) { bonusCounter.Text = $"{1000 * (currentSpins - spinsRequired)}"; bonusCounter.FadeOutFromOne(1500); diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 4c21d9cfde..1c30058d5d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -3,13 +3,11 @@ using System; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Judgements; -using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Scoring; -using osuTK; namespace osu.Game.Rulesets.Osu.Objects { @@ -28,6 +26,8 @@ public double EndTime /// public int SpinsRequired { get; protected set; } = 1; + public int MaximumBonusSpins => SpinsRequired; + protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); @@ -42,9 +42,16 @@ protected override void CreateNestedHitObjects() { base.CreateNestedHitObjects(); - var maximumSpins = OsuAutoGeneratorBase.SPIN_RADIUS * (Duration / 1000) / MathHelper.TwoPi; - for (int i = 0; i < maximumSpins; i++) - AddNested(new SpinnerTick()); + int totalSpins = MaximumBonusSpins + SpinsRequired; + + for (int i = 0; i < totalSpins; i++) + { + double startTime = StartTime + (float)(i + 1) / totalSpins * Duration; + + AddNested(i < SpinsRequired + ? new SpinnerTick { StartTime = startTime } + : new SpinnerBonusTick { StartTime = startTime }); + } } public override Judgement CreateJudgement() => new OsuJudgement(); diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs new file mode 100644 index 0000000000..84eb58c70b --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Audio; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Osu.Objects +{ + public class SpinnerBonusTick : SpinnerTick + { + public SpinnerBonusTick() + { + Samples.Add(new HitSampleInfo { Name = "spinnerbonus" }); + } + + public override Judgement CreateJudgement() => new OsuSpinnerBonusTickJudgement(); + + public class OsuSpinnerBonusTickJudgement : OsuSpinnerTickJudgement + { + protected override int NumericResultFor(HitResult result) => 1100; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs index 318e8e71a2..89ad45b267 100644 --- a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Audio; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; @@ -10,13 +9,17 @@ namespace osu.Game.Rulesets.Osu.Objects { public class SpinnerTick : OsuHitObject { - public SpinnerTick() - { - Samples.Add(new HitSampleInfo { Name = "spinnerbonus" }); - } - public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement(); protected override HitWindows CreateHitWindows() => HitWindows.Empty; + + public class OsuSpinnerTickJudgement : OsuJudgement + { + public override bool AffectsCombo => false; + + protected override int NumericResultFor(HitResult result) => 100; + + protected override double HealthIncreaseFor(HitResult result) => 0; + } } } From 947f4e0d4c5aac6609ef6cfdf5488256402c6376 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 19:03:17 +0900 Subject: [PATCH 050/106] Move tick handling to DrawableSpinner itself --- .../Objects/Drawables/DrawableSpinner.cs | 42 ++++++++- .../Objects/Drawables/DrawableSpinnerTick.cs | 7 +- .../Drawables/Pieces/SpinnerBonusComponent.cs | 87 ------------------- .../Drawables/Pieces/SpinnerBonusDisplay.cs | 44 ++++++++++ 4 files changed, 86 insertions(+), 94 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 531d16d1d1..df6eb206da 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -30,7 +30,7 @@ public class DrawableSpinner : DrawableOsuHitObject public readonly SpinnerDisc Disc; public readonly SpinnerTicks Ticks; public readonly SpinnerSpmCounter SpmCounter; - private readonly SpinnerBonusComponent bonusComponent; + private readonly SpinnerBonusDisplay bonusDisplay; private readonly Container mainContainer; @@ -126,7 +126,7 @@ public DrawableSpinner(Spinner s) Y = 120, Alpha = 0 }, - bonusComponent = new SpinnerBonusComponent(this, ticks) + bonusDisplay = new SpinnerBonusDisplay { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -199,6 +199,10 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) if (userTriggered || Time.Current < Spinner.EndTime) return; + // Trigger a miss result for remaining ticks to avoid infinite gameplay. + foreach (var tick in ticks.Where(t => !t.IsHit)) + tick.TriggerResult(HitResult.Miss); + ApplyResult(r => { if (Progress >= 1) @@ -230,7 +234,8 @@ protected override void UpdateAfterChildren() Ticks.Rotation = Disc.Rotation; SpmCounter.SetRotation(Disc.CumulativeRotation); - bonusComponent.SetRotation(Disc.CumulativeRotation); + + updateBonusScore(); float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; float targetScale = relativeCircleScale + (1 - relativeCircleScale) * Progress; @@ -239,6 +244,37 @@ protected override void UpdateAfterChildren() symbol.Rotation = (float)Interpolation.Lerp(symbol.Rotation, Disc.Rotation / 2, Math.Clamp(Math.Abs(Time.Elapsed) / 40, 0, 1)); } + private int wholeSpins; + + private void updateBonusScore() + { + if (ticks.Count == 0) + return; + + int spins = (int)(Disc.CumulativeRotation / 360); + + while (wholeSpins != spins) + { + if (wholeSpins < spins) + { + var tick = ticks.FirstOrDefault(t => !t.IsHit); + + if (tick != null) + { + tick.TriggerResult(HitResult.Great); + if (tick is DrawableSpinnerBonusTick) + bonusDisplay.SetBonusCount(spins - Spinner.SpinsRequired); + } + + wholeSpins++; + } + else + { + wholeSpins--; + } + } + } + protected override void UpdateInitialTransforms() { base.UpdateInitialTransforms(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 5fb7653f5a..6c9570c381 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -17,11 +17,10 @@ public DrawableSpinnerTick(SpinnerTick spinnerTick) /// /// Apply a judgement result. /// - /// Whether to apply a result, otherwise. - internal void TriggerResult(bool hit) + /// Whether to apply a result, otherwise. + internal void TriggerResult(HitResult result) { - HitObject.StartTime = Time.Current; - ApplyResult(r => r.Type = hit ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = result); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs deleted file mode 100644 index 9a65247453..0000000000 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusComponent.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Linq; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Objects.Drawables; - -namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces -{ - /// - /// A component that tracks spinner spins and add bonus score for it. - /// - public class SpinnerBonusComponent : CompositeDrawable - { - private readonly DrawableSpinner drawableSpinner; - private readonly Container ticks; - private readonly OsuSpriteText bonusCounter; - - public SpinnerBonusComponent(DrawableSpinner drawableSpinner, Container ticks) - { - this.drawableSpinner = drawableSpinner; - this.ticks = ticks; - - drawableSpinner.OnNewResult += onNewResult; - - AutoSizeAxes = Axes.Both; - InternalChild = bonusCounter = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = OsuFont.Numeric.With(size: 24), - Alpha = 0, - }; - } - - private int currentSpins; - - public void SetRotation(double rotation) - { - if (ticks.Count == 0) - return; - - int spinsRequired = ((Spinner)drawableSpinner.HitObject).SpinsRequired; - - int newSpins = Math.Clamp((int)(rotation / 360), 0, ticks.Count - 1); - int direction = Math.Sign(newSpins - currentSpins); - - while (currentSpins != newSpins) - { - var tick = ticks[currentSpins]; - - if (direction >= 0) - tick.TriggerResult(true); - - if (tick is DrawableSpinnerBonusTick) - { - bonusCounter.Text = $"{1000 * (currentSpins - spinsRequired)}"; - bonusCounter.FadeOutFromOne(1500); - bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint); - } - - currentSpins += direction; - } - } - - private void onNewResult(DrawableHitObject hitObject, JudgementResult result) - { - if (!result.HasResult || hitObject != drawableSpinner) - return; - - // Trigger a miss result for remaining ticks to avoid infinite gameplay. - foreach (var tick in ticks.Where(t => !t.IsHit)) - tick.TriggerResult(false); - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - drawableSpinner.OnNewResult -= onNewResult; - } - } -} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs new file mode 100644 index 0000000000..76d7f1843e --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs @@ -0,0 +1,44 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces +{ + /// + /// A component that tracks spinner spins and add bonus score for it. + /// + public class SpinnerBonusDisplay : CompositeDrawable + { + private readonly OsuSpriteText bonusCounter; + + public SpinnerBonusDisplay() + { + AutoSizeAxes = Axes.Both; + + InternalChild = bonusCounter = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.Numeric.With(size: 24), + Alpha = 0, + }; + } + + private int displayedCount; + + public void SetBonusCount(int count) + { + if (displayedCount == count) + return; + + displayedCount = count; + bonusCounter.Text = $"{1000 * count}"; + bonusCounter.FadeOutFromOne(1500); + bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint); + } + } +} From 7f2ae694cc96e41175932d16353fa3e1c0a3e9ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 19:21:30 +0900 Subject: [PATCH 051/106] Simplify rewind handling --- .../Objects/Drawables/DrawableSpinner.cs | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index df6eb206da..a8ecb60038 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -253,25 +253,26 @@ private void updateBonusScore() int spins = (int)(Disc.CumulativeRotation / 360); + if (spins < wholeSpins) + { + // rewinding, silently handle + wholeSpins = spins; + return; + } + while (wholeSpins != spins) { - if (wholeSpins < spins) - { - var tick = ticks.FirstOrDefault(t => !t.IsHit); + var tick = ticks.FirstOrDefault(t => !t.IsHit); - if (tick != null) - { - tick.TriggerResult(HitResult.Great); - if (tick is DrawableSpinnerBonusTick) - bonusDisplay.SetBonusCount(spins - Spinner.SpinsRequired); - } - - wholeSpins++; - } - else + // tick may be null if we've hit the spin limit. + if (tick != null) { - wholeSpins--; + tick.TriggerResult(HitResult.Great); + if (tick is DrawableSpinnerBonusTick) + bonusDisplay.SetBonusCount(spins - Spinner.SpinsRequired); } + + wholeSpins++; } } From a4680d7a8945ded3804b0a0b84500a0a47241e44 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 19:22:42 +0900 Subject: [PATCH 052/106] Reduce test range as to not hit spin cat --- osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs index 0f1cbcd44c..6e277ff37e 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerRotation.cs @@ -164,13 +164,13 @@ public void TestSpinPerMinuteOnRewind() { double estimatedSpm = 0; - addSeekStep(2500); + addSeekStep(1000); AddStep("retrieve spm", () => estimatedSpm = drawableSpinner.SpmCounter.SpinsPerMinute); - addSeekStep(5000); + addSeekStep(2000); AddAssert("spm still valid", () => Precision.AlmostEquals(drawableSpinner.SpmCounter.SpinsPerMinute, estimatedSpm, 1.0)); - addSeekStep(2500); + addSeekStep(1000); AddAssert("spm still valid", () => Precision.AlmostEquals(drawableSpinner.SpmCounter.SpinsPerMinute, estimatedSpm, 1.0)); } From 1560e1786a09475d4537bfc02b881d8bb2f422f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 19:48:44 +0900 Subject: [PATCH 053/106] Revert back to bool for application --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 4 ++-- .../Objects/Drawables/DrawableSpinnerTick.cs | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index a8ecb60038..ecf78efdd9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -201,7 +201,7 @@ protected override void CheckForResult(bool userTriggered, double timeOffset) // Trigger a miss result for remaining ticks to avoid infinite gameplay. foreach (var tick in ticks.Where(t => !t.IsHit)) - tick.TriggerResult(HitResult.Miss); + tick.TriggerResult(false); ApplyResult(r => { @@ -267,7 +267,7 @@ private void updateBonusScore() // tick may be null if we've hit the spin limit. if (tick != null) { - tick.TriggerResult(HitResult.Great); + tick.TriggerResult(true); if (tick is DrawableSpinnerBonusTick) bonusDisplay.SetBonusCount(spins - Spinner.SpinsRequired); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs index 6c9570c381..c390b673be 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs @@ -17,10 +17,7 @@ public DrawableSpinnerTick(SpinnerTick spinnerTick) /// /// Apply a judgement result. /// - /// Whether to apply a result, otherwise. - internal void TriggerResult(HitResult result) - { - ApplyResult(r => r.Type = result); - } + /// Whether this tick was reached. + internal void TriggerResult(bool hit) => ApplyResult(r => r.Type = hit ? r.Judgement.MaxResult : HitResult.Miss); } } From bc079fccf52d5d338609ca87249208a899343958 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Jul 2020 19:52:16 +0900 Subject: [PATCH 054/106] Add health drain for spinner ticks --- osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs | 2 ++ osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs index 84eb58c70b..6ca2d4d72d 100644 --- a/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerBonusTick.cs @@ -19,6 +19,8 @@ public SpinnerBonusTick() public class OsuSpinnerBonusTickJudgement : OsuSpinnerTickJudgement { protected override int NumericResultFor(HitResult result) => 1100; + + protected override double HealthIncreaseFor(HitResult result) => base.HealthIncreaseFor(result) * 2; } } } diff --git a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs index 89ad45b267..c81348fbbf 100644 --- a/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SpinnerTick.cs @@ -19,7 +19,7 @@ public class OsuSpinnerTickJudgement : OsuJudgement protected override int NumericResultFor(HitResult result) => 100; - protected override double HealthIncreaseFor(HitResult result) => 0; + protected override double HealthIncreaseFor(HitResult result) => result == MaxResult ? 0.6 * base.HealthIncreaseFor(result) : 0; } } } From 107b5ca4f2ab5ca29356aad95a852cb28aa4e856 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Jul 2020 23:13:04 +0900 Subject: [PATCH 055/106] Add support for bindable retrieval --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 186 ++++++++++++++++-- osu.Game/OsuGameBase.cs | 5 +- .../Carousel/DrawableCarouselBeatmap.cs | 59 ++---- .../Screens/Select/Details/AdvancedStats.cs | 25 ++- 4 files changed, 208 insertions(+), 67 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index 02342e9595..379cb6aa63 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -9,7 +9,9 @@ using System.Threading.Tasks; using JetBrains.Annotations; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; +using osu.Framework.Lists; using osu.Framework.Threading; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -21,32 +23,154 @@ public class BeatmapDifficultyManager : CompositeDrawable // Too many simultaneous updates can lead to stutters. One thread seems to work fine for song select display purposes. private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(1, nameof(BeatmapDifficultyManager)); - private readonly TimedExpiryCache difficultyCache = new TimedExpiryCache { ExpiryTime = 60000 }; - private readonly BeatmapManager beatmapManager; + // A cache that keeps references to BeatmapInfos for 60sec. + private readonly TimedExpiryCache difficultyCache = new TimedExpiryCache { ExpiryTime = 60000 }; - public BeatmapDifficultyManager(BeatmapManager beatmapManager) + // All bindables that should be updated along with the current ruleset + mods. + private readonly LockedWeakList trackedBindables = new LockedWeakList(); + + [Resolved] + private BeatmapManager beatmapManager { get; set; } + + [Resolved] + private Bindable currentRuleset { get; set; } + + [Resolved] + private Bindable> currentMods { get; set; } + + protected override void LoadComplete() { - this.beatmapManager = beatmapManager; + base.LoadComplete(); + + currentRuleset.BindValueChanged(_ => updateTrackedBindables()); + currentMods.BindValueChanged(_ => updateTrackedBindables(), true); } - public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, - CancellationToken cancellationToken = default) + /// + /// Retrieves an containing the star difficulty of a with a given and combination. + /// + /// + /// This will not update to follow the currently-selected ruleset and mods. + /// + /// The to get the difficulty of. + /// The to get the difficulty with. + /// The s to get the difficulty with. + /// An optional which stops updating the star difficulty for the given . + /// An that is updated to contain the star difficulty when it becomes available. + public IBindable GetUntrackedBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, + CancellationToken cancellationToken = default) + => createBindable(beatmapInfo, rulesetInfo, mods, cancellationToken); + + /// + /// Retrieves a containing the star difficulty of a that follows the user's currently-selected ruleset and mods. + /// + /// + /// Ensure to hold a local reference of the returned in order to receive value-changed events. + /// + /// The to get the difficulty of. + /// An optional which stops updating the star difficulty for the given . + /// An that is updated to contain the star difficulty when it becomes available, or when the currently-selected ruleset and mods change. + public IBindable GetTrackedBindable([NotNull] BeatmapInfo beatmapInfo, CancellationToken cancellationToken = default) + { + var bindable = createBindable(beatmapInfo, currentRuleset.Value, currentMods.Value, cancellationToken); + trackedBindables.Add(bindable); + return bindable; + } + + /// + /// Retrieves the difficulty of a . + /// + /// The to get the difficulty of. + /// The to get the difficulty with. + /// The s to get the difficulty with. + /// An optional which stops computing the star difficulty. + /// The . + public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, + CancellationToken cancellationToken = default) { if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; - return await Task.Factory.StartNew(() => getDifficulty(key), cancellationToken, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler); + return await Task.Factory.StartNew(() => computeDifficulty(key), cancellationToken, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler); } - public double GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null) + /// + /// Retrieves the difficulty of a . + /// + /// The to get the difficulty of. + /// The to get the difficulty with. + /// The s to get the difficulty with. + /// The . + public StarDifficulty GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null) { if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; - return getDifficulty(key); + return computeDifficulty(key); } - private double getDifficulty(in DifficultyCacheLookup key) + private CancellationTokenSource trackedUpdateCancellationSource; + + /// + /// Updates all tracked using the current ruleset and mods. + /// + private void updateTrackedBindables() + { + trackedUpdateCancellationSource?.Cancel(); + trackedUpdateCancellationSource = new CancellationTokenSource(); + + foreach (var b in trackedBindables) + { + if (trackedUpdateCancellationSource.IsCancellationRequested) + break; + + using (var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(trackedUpdateCancellationSource.Token, b.CancellationToken)) + updateBindable(b, currentRuleset.Value, currentMods.Value, linkedSource.Token); + } + } + + /// + /// Updates the value of a with a given ruleset + mods. + /// + /// The to update. + /// The to update with. + /// The s to update with. + /// A token that may be used to cancel this update. + private void updateBindable([NotNull] BindableStarDifficulty bindable, [CanBeNull] RulesetInfo rulesetInfo, [CanBeNull] IReadOnlyList mods, CancellationToken cancellationToken = default) + { + GetDifficultyAsync(bindable.Beatmap, rulesetInfo, mods, cancellationToken).ContinueWith(t => + { + // We're on a threadpool thread, but we should exit back to the update thread so consumers can safely handle value-changed events. + Schedule(() => + { + if (!cancellationToken.IsCancellationRequested) + bindable.Value = t.Result; + }); + }, cancellationToken); + } + + /// + /// Creates a new and triggers an initial value update. + /// + /// The that star difficulty should correspond to. + /// The initial to get the difficulty with. + /// The initial s to get the difficulty with. + /// An optional which stops updating the star difficulty for the given . + /// The . + private BindableStarDifficulty createBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo initialRulesetInfo, [CanBeNull] IReadOnlyList initialMods, + CancellationToken cancellationToken) + { + var bindable = new BindableStarDifficulty(beatmapInfo, cancellationToken); + updateBindable(bindable, initialRulesetInfo, initialMods, cancellationToken); + return bindable; + } + + /// + /// Computes the difficulty defined by a key, and stores it to the timed cache. + /// + /// The that defines the computation parameters. + /// The . + private StarDifficulty computeDifficulty(in DifficultyCacheLookup key) { try { @@ -56,13 +180,17 @@ private double getDifficulty(in DifficultyCacheLookup key) var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(key.BeatmapInfo)); var attributes = calculator.Calculate(key.Mods); - difficultyCache.Add(key, attributes.StarRating); - return attributes.StarRating; + var difficulty = new StarDifficulty(attributes.StarRating); + difficultyCache.Add(key, difficulty); + + return difficulty; } catch { - difficultyCache.Add(key, 0); - return 0; + var difficulty = new StarDifficulty(0); + difficultyCache.Add(key, difficulty); + + return difficulty; } } @@ -73,9 +201,9 @@ private double getDifficulty(in DifficultyCacheLookup key) /// The . /// The s. /// The existing difficulty value, if present. - /// The key that was used to perform this lookup. This can be further used to query . + /// The key that was used to perform this lookup. This can be further used to query . /// Whether an existing difficulty was found. - private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IReadOnlyList mods, out double existingDifficulty, out DifficultyCacheLookup key) + private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IReadOnlyList mods, out StarDifficulty existingDifficulty, out DifficultyCacheLookup key) { // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. rulesetInfo ??= beatmapInfo.Ruleset; @@ -83,7 +211,7 @@ private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, // Difficulty can only be computed if the beatmap is locally available. if (beatmapInfo.ID == 0) { - existingDifficulty = 0; + existingDifficulty = new StarDifficulty(0); key = default; return true; @@ -122,5 +250,29 @@ public override int GetHashCode() return hashCode.ToHashCode(); } } + + private class BindableStarDifficulty : Bindable + { + public readonly BeatmapInfo Beatmap; + public readonly CancellationToken CancellationToken; + + public BindableStarDifficulty(BeatmapInfo beatmap, CancellationToken cancellationToken) + { + Beatmap = beatmap; + CancellationToken = cancellationToken; + } + } + } + + public readonly struct StarDifficulty + { + public readonly double Stars; + + public StarDifficulty(double stars) + { + Stars = stars; + + // Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...) + } } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1e6631ffa0..fe5c0704b7 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -199,7 +199,10 @@ List getBeatmapScores(BeatmapSetInfo set) ScoreManager.Undelete(getBeatmapScores(item), true); }); - dependencies.Cache(new BeatmapDifficultyManager(BeatmapManager)); + var difficultyManager = new BeatmapDifficultyManager(); + dependencies.Cache(difficultyManager); + AddInternal(difficultyManager); + dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore)); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index d4205a4b93..d5aeecae04 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -15,7 +15,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -23,8 +22,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Graphics; @@ -46,15 +43,12 @@ public class DrawableCarouselBeatmap : DrawableCarouselItem, IHasContextMenu [Resolved(CanBeNull = true)] private BeatmapSetOverlay beatmapOverlay { get; set; } - [Resolved] - private IBindable ruleset { get; set; } - - [Resolved] - private IBindable> mods { get; set; } - [Resolved] private BeatmapDifficultyManager difficultyManager { get; set; } + private IBindable starDifficultyBindable; + private CancellationTokenSource starDifficultyCancellationSource; + public DrawableCarouselBeatmap(CarouselBeatmap panel) : base(panel) { @@ -160,36 +154,6 @@ private void load(BeatmapManager manager, SongSelect songSelect) } } }; - - ruleset.BindValueChanged(_ => refreshStarCounter()); - mods.BindValueChanged(_ => refreshStarCounter(), true); - } - - private ScheduledDelegate scheduledRefresh; - private CancellationTokenSource cancellationSource; - - private void refreshStarCounter() - { - scheduledRefresh?.Cancel(); - scheduledRefresh = null; - - cancellationSource?.Cancel(); - cancellationSource = null; - - // Only want to run the calculation when we become visible. - scheduledRefresh = Schedule(() => - { - var ourSource = cancellationSource = new CancellationTokenSource(); - difficultyManager.GetDifficultyAsync(beatmap, ruleset.Value, mods.Value, ourSource.Token).ContinueWith(t => - { - // We're currently on a random threadpool thread which we must exit. - Schedule(() => - { - if (!ourSource.IsCancellationRequested) - starCounter.Current = (float)t.Result; - }); - }, ourSource.Token); - }); } protected override void Selected() @@ -224,6 +188,17 @@ protected override void ApplyState() if (Item.State.Value != CarouselItemState.Collapsed && Alpha == 0) starCounter.ReplayAnimation(); + if (Item.State.Value == CarouselItemState.Collapsed) + starDifficultyCancellationSource?.Cancel(); + else + { + starDifficultyCancellationSource?.Cancel(); + + // We've potentially cancelled the computation above so a new bindable is required. + starDifficultyBindable = difficultyManager.GetTrackedBindable(beatmap, (starDifficultyCancellationSource = new CancellationTokenSource()).Token); + starDifficultyBindable.BindValueChanged(d => starCounter.Current = (float)d.NewValue.Stars, true); + } + base.ApplyState(); } @@ -248,5 +223,11 @@ public MenuItem[] ContextMenuItems return items.ToArray(); } } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + starDifficultyCancellationSource?.Cancel(); + } } } diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index c5fc3701f8..aefba397b9 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -15,7 +15,6 @@ using osu.Game.Rulesets.Mods; using System.Linq; using System.Threading; -using System.Threading.Tasks; using osu.Framework.Threading; using osu.Framework.Utils; using osu.Game.Configuration; @@ -149,6 +148,8 @@ private void updateStatistics() updateStarDifficulty(); } + private IBindable normalStarDifficulty; + private IBindable moddedStarDifficulty; private CancellationTokenSource starDifficultyCancellationSource; private void updateStarDifficulty() @@ -160,15 +161,19 @@ private void updateStarDifficulty() var ourSource = starDifficultyCancellationSource = new CancellationTokenSource(); - Task.WhenAll(difficultyManager.GetDifficultyAsync(Beatmap, ruleset.Value, cancellationToken: ourSource.Token), - difficultyManager.GetDifficultyAsync(Beatmap, ruleset.Value, mods.Value, ourSource.Token)).ContinueWith(t => - { - Schedule(() => - { - if (!ourSource.IsCancellationRequested) - starDifficulty.Value = ((float)t.Result[0], (float)t.Result[1]); - }); - }, ourSource.Token); + normalStarDifficulty = difficultyManager.GetUntrackedBindable(Beatmap, ruleset.Value, cancellationToken: ourSource.Token); + moddedStarDifficulty = difficultyManager.GetUntrackedBindable(Beatmap, ruleset.Value, mods.Value, ourSource.Token); + + normalStarDifficulty.BindValueChanged(_ => updateDisplay()); + moddedStarDifficulty.BindValueChanged(_ => updateDisplay(), true); + + void updateDisplay() => starDifficulty.Value = ((float)normalStarDifficulty.Value.Stars, (float)moddedStarDifficulty.Value.Stars); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + starDifficultyCancellationSource?.Cancel(); } public class StatisticRow : Container, IHasAccentColour From 00e6217f60c9d1981e1eb16e1b21b39a70b844a9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Jul 2020 23:50:54 +0900 Subject: [PATCH 056/106] Don't store BeatmapInfo/RulesetInfo references, remove TimedExpiryCache --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index 379cb6aa63..b469ca78fb 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -24,7 +25,7 @@ public class BeatmapDifficultyManager : CompositeDrawable private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(1, nameof(BeatmapDifficultyManager)); // A cache that keeps references to BeatmapInfos for 60sec. - private readonly TimedExpiryCache difficultyCache = new TimedExpiryCache { ExpiryTime = 60000 }; + private readonly ConcurrentDictionary difficultyCache = new ConcurrentDictionary(); // All bindables that should be updated along with the current ruleset + mods. private readonly LockedWeakList trackedBindables = new LockedWeakList(); @@ -91,7 +92,8 @@ public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatm if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; - return await Task.Factory.StartNew(() => computeDifficulty(key), cancellationToken, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler); + return await Task.Factory.StartNew(() => computeDifficulty(key, beatmapInfo, rulesetInfo), cancellationToken, + TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler); } /// @@ -106,7 +108,7 @@ public StarDifficulty GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNul if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; - return computeDifficulty(key); + return computeDifficulty(key, beatmapInfo, rulesetInfo); } private CancellationTokenSource trackedUpdateCancellationSource; @@ -169,28 +171,24 @@ private BindableStarDifficulty createBindable([NotNull] BeatmapInfo beatmapInfo, /// Computes the difficulty defined by a key, and stores it to the timed cache. /// /// The that defines the computation parameters. + /// The to compute the difficulty of. + /// The to compute the difficulty with. /// The . - private StarDifficulty computeDifficulty(in DifficultyCacheLookup key) + private StarDifficulty computeDifficulty(in DifficultyCacheLookup key, BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo) { try { - var ruleset = key.RulesetInfo.CreateInstance(); + var ruleset = rulesetInfo.CreateInstance(); Debug.Assert(ruleset != null); - var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(key.BeatmapInfo)); + var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(beatmapInfo)); var attributes = calculator.Calculate(key.Mods); - var difficulty = new StarDifficulty(attributes.StarRating); - difficultyCache.Add(key, difficulty); - - return difficulty; + return difficultyCache[key] = new StarDifficulty(attributes.StarRating); } catch { - var difficulty = new StarDifficulty(0); - difficultyCache.Add(key, difficulty); - - return difficulty; + return difficultyCache[key] = new StarDifficulty(0); } } @@ -208,8 +206,8 @@ private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. rulesetInfo ??= beatmapInfo.Ruleset; - // Difficulty can only be computed if the beatmap is locally available. - if (beatmapInfo.ID == 0) + // Difficulty can only be computed if the beatmap and ruleset are locally available. + if (beatmapInfo.ID == 0 || rulesetInfo.ID == null) { existingDifficulty = new StarDifficulty(0); key = default; @@ -217,33 +215,34 @@ private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, return true; } - key = new DifficultyCacheLookup(beatmapInfo, rulesetInfo, mods); + key = new DifficultyCacheLookup(beatmapInfo.ID, rulesetInfo.ID.Value, mods); return difficultyCache.TryGetValue(key, out existingDifficulty); } private readonly struct DifficultyCacheLookup : IEquatable { - public readonly BeatmapInfo BeatmapInfo; - public readonly RulesetInfo RulesetInfo; + public readonly int BeatmapId; + public readonly int RulesetId; public readonly Mod[] Mods; - public DifficultyCacheLookup(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IEnumerable mods) + public DifficultyCacheLookup(int beatmapId, int rulesetId, IEnumerable mods) { - BeatmapInfo = beatmapInfo; - RulesetInfo = rulesetInfo; + BeatmapId = beatmapId; + RulesetId = rulesetId; Mods = mods?.OrderBy(m => m.Acronym).ToArray() ?? Array.Empty(); } public bool Equals(DifficultyCacheLookup other) - => BeatmapInfo.Equals(other.BeatmapInfo) + => BeatmapId == other.BeatmapId + && RulesetId == other.RulesetId && Mods.SequenceEqual(other.Mods); public override int GetHashCode() { var hashCode = new HashCode(); - hashCode.Add(BeatmapInfo.Hash); - hashCode.Add(RulesetInfo.GetHashCode()); + hashCode.Add(BeatmapId); + hashCode.Add(RulesetId); foreach (var mod in Mods) hashCode.Add(mod.Acronym); From e96f8f1cb652e4d312758b20414f74c01d144ca0 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 21 Jul 2020 20:02:22 +0300 Subject: [PATCH 057/106] Make content side padding adjustable for OverlayHeader --- .../UserInterface/TestSceneOverlayHeader.cs | 20 +++++++++++--- osu.Game/Overlays/OverlayHeader.cs | 27 ++++++++++++++----- osu.Game/Overlays/TabControlOverlayHeader.cs | 24 ++++++++++++++--- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs index 60af5b37ef..01c13dbc97 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs @@ -36,11 +36,11 @@ public TestSceneOverlayHeader() } }); - addHeader("Orange OverlayHeader (no background)", new TestNoBackgroundHeader(), OverlayColourScheme.Orange); - addHeader("Blue OverlayHeader", new TestNoControlHeader(), OverlayColourScheme.Blue); + addHeader("Orange OverlayHeader (no background, 100 padding)", new TestNoBackgroundHeader(), OverlayColourScheme.Orange); + addHeader("Blue OverlayHeader (default 70 padding)", new TestNoControlHeader(), OverlayColourScheme.Blue); addHeader("Green TabControlOverlayHeader (string) with ruleset selector", new TestStringTabControlHeader(), OverlayColourScheme.Green); - addHeader("Pink TabControlOverlayHeader (enum)", new TestEnumTabControlHeader(), OverlayColourScheme.Pink); - addHeader("Red BreadcrumbControlOverlayHeader (no background)", new TestBreadcrumbControlHeader(), OverlayColourScheme.Red); + addHeader("Pink TabControlOverlayHeader (enum, 30 padding)", new TestEnumTabControlHeader(), OverlayColourScheme.Pink); + addHeader("Red BreadcrumbControlOverlayHeader (no background, 10 padding)", new TestBreadcrumbControlHeader(), OverlayColourScheme.Red); } private void addHeader(string name, OverlayHeader header, OverlayColourScheme colourScheme) @@ -86,6 +86,11 @@ public ColourProvidedContainer(OverlayColourScheme colourScheme, OverlayHeader h private class TestNoBackgroundHeader : OverlayHeader { protected override OverlayTitle CreateTitle() => new TestTitle(); + + public TestNoBackgroundHeader() + { + ContentSidePadding = 100; + } } private class TestNoControlHeader : OverlayHeader @@ -112,6 +117,11 @@ public TestStringTabControlHeader() private class TestEnumTabControlHeader : TabControlOverlayHeader { + public TestEnumTabControlHeader() + { + ContentSidePadding = 30; + } + protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/rankings"); protected override OverlayTitle CreateTitle() => new TestTitle(); @@ -130,6 +140,8 @@ private class TestBreadcrumbControlHeader : BreadcrumbControlOverlayHeader public TestBreadcrumbControlHeader() { + ContentSidePadding = 10; + TabControl.AddItem("tab1"); TabControl.AddItem("tab2"); TabControl.Current.Value = "tab2"; diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs index dbc934bde9..c9b9e3b836 100644 --- a/osu.Game/Overlays/OverlayHeader.cs +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -12,9 +12,26 @@ namespace osu.Game.Overlays { public abstract class OverlayHeader : Container { - public const int CONTENT_X_MARGIN = 50; + private float contentSidePadding; + + /// + /// Horizontal padding of the header content. + /// + protected float ContentSidePadding + { + get => contentSidePadding; + set + { + contentSidePadding = value; + content.Padding = new MarginPadding + { + Horizontal = value + }; + } + } private readonly Box titleBackground; + private readonly Container content; protected readonly FillFlowContainer HeaderInfo; @@ -50,14 +67,10 @@ protected OverlayHeader() RelativeSizeAxes = Axes.Both, Colour = Color4.Gray, }, - new Container + content = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding - { - Horizontal = CONTENT_X_MARGIN, - }, Children = new[] { CreateTitle().With(title => @@ -79,6 +92,8 @@ protected OverlayHeader() CreateContent() } }); + + ContentSidePadding = 70; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/TabControlOverlayHeader.cs b/osu.Game/Overlays/TabControlOverlayHeader.cs index e8e000f441..61605d9e9e 100644 --- a/osu.Game/Overlays/TabControlOverlayHeader.cs +++ b/osu.Game/Overlays/TabControlOverlayHeader.cs @@ -22,6 +22,7 @@ public abstract class TabControlOverlayHeader : OverlayHeader, IHasCurrentVal protected OsuTabControl TabControl; private readonly Box controlBackground; + private readonly Container tabControlContainer; private readonly BindableWithCurrent current = new BindableWithCurrent(); public Bindable Current @@ -30,6 +31,16 @@ public Bindable Current set => current.Current = value; } + protected new float ContentSidePadding + { + get => base.ContentSidePadding; + set + { + base.ContentSidePadding = value; + tabControlContainer.Padding = new MarginPadding { Horizontal = value }; + } + } + protected TabControlOverlayHeader() { HeaderInfo.Add(new Container @@ -42,11 +53,16 @@ protected TabControlOverlayHeader() { RelativeSizeAxes = Axes.Both, }, - TabControl = CreateTabControl().With(control => + tabControlContainer = new Container { - control.Margin = new MarginPadding { Left = CONTENT_X_MARGIN }; - control.Current = Current; - }) + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = ContentSidePadding }, + Child = TabControl = CreateTabControl().With(control => + { + control.Current = Current; + }) + } } }); } From 0145ca09e5d8ebd98a85857c6fab121d7c112143 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 21 Jul 2020 20:11:10 +0300 Subject: [PATCH 058/106] Apply changes to overlays --- osu.Game/Overlays/OverlayHeader.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/OverlayHeader.cs b/osu.Game/Overlays/OverlayHeader.cs index c9b9e3b836..cc7f798c4a 100644 --- a/osu.Game/Overlays/OverlayHeader.cs +++ b/osu.Game/Overlays/OverlayHeader.cs @@ -93,7 +93,7 @@ protected OverlayHeader() } }); - ContentSidePadding = 70; + ContentSidePadding = 50; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 0161d91daa..2895fa0726 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -23,6 +23,8 @@ public class ProfileHeader : TabControlOverlayHeader public ProfileHeader() { + ContentSidePadding = 70; + User.ValueChanged += e => updateDisplay(e.NewValue); TabControl.AddItem("info"); From 0a71194ea69e07e516be8db5c9180d612459aec8 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 21 Jul 2020 22:46:08 +0300 Subject: [PATCH 059/106] Fix SpotlightSelector is a VisibilityContainer without a reason --- .../TestSceneRankingsSpotlightSelector.cs | 6 - .../Overlays/Rankings/SpotlightSelector.cs | 104 ++++++++---------- .../Overlays/Rankings/SpotlightsLayout.cs | 2 - 3 files changed, 45 insertions(+), 67 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs index 997db827f3..d60222fa0b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsSpotlightSelector.cs @@ -30,12 +30,6 @@ public TestSceneRankingsSpotlightSelector() Add(selector = new SpotlightSelector()); } - [Test] - public void TestVisibility() - { - AddStep("Toggle Visibility", selector.ToggleVisibility); - } - [Test] public void TestLocalSpotlights() { diff --git a/osu.Game/Overlays/Rankings/SpotlightSelector.cs b/osu.Game/Overlays/Rankings/SpotlightSelector.cs index f112c1ec43..422373d099 100644 --- a/osu.Game/Overlays/Rankings/SpotlightSelector.cs +++ b/osu.Game/Overlays/Rankings/SpotlightSelector.cs @@ -18,10 +18,8 @@ namespace osu.Game.Overlays.Rankings { - public class SpotlightSelector : VisibilityContainer, IHasCurrentValue + public class SpotlightSelector : CompositeDrawable, IHasCurrentValue { - private const int duration = 300; - private readonly BindableWithCurrent current = new BindableWithCurrent(); public readonly Bindable Sort = new Bindable(); @@ -37,10 +35,7 @@ public IEnumerable Spotlights set => dropdown.Items = value; } - protected override bool StartHidden => true; - private readonly Box background; - private readonly Container content; private readonly SpotlightsDropdown dropdown; private readonly InfoColumn startDateColumn; private readonly InfoColumn endDateColumn; @@ -51,73 +46,68 @@ public SpotlightSelector() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Add(content = new Container + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] + background = new Box { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new Container + RelativeSizeAxes = Axes.Both, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN }, + Child = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN }, - Child = new FillFlowContainer + Direction = FillDirection.Vertical, + Children = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] + new Container { - new Container - { - Margin = new MarginPadding { Vertical = 20 }, - RelativeSizeAxes = Axes.X, - Height = 40, - Depth = -float.MaxValue, - Child = dropdown = new SpotlightsDropdown - { - RelativeSizeAxes = Axes.X, - Current = Current - } - }, - new Container + Margin = new MarginPadding { Vertical = 20 }, + RelativeSizeAxes = Axes.X, + Height = 40, + Depth = -float.MaxValue, + Child = dropdown = new SpotlightsDropdown { RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Children = new Drawable[] + Current = Current + } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new FillFlowContainer { - new FillFlowContainer + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(10, 0), + Margin = new MarginPadding { Bottom = 5 }, + Children = new Drawable[] { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(10, 0), - Margin = new MarginPadding { Bottom = 5 }, - Children = new Drawable[] - { - startDateColumn = new InfoColumn(@"Start Date"), - endDateColumn = new InfoColumn(@"End Date"), - mapCountColumn = new InfoColumn(@"Map Count"), - participantsColumn = new InfoColumn(@"Participants") - } - }, - new RankingsSortTabControl - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Current = Sort + startDateColumn = new InfoColumn(@"Start Date"), + endDateColumn = new InfoColumn(@"End Date"), + mapCountColumn = new InfoColumn(@"Map Count"), + participantsColumn = new InfoColumn(@"Participants") } + }, + new RankingsSortTabControl + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Current = Sort } } } } } } - }); + }; } [BackgroundDependencyLoader] @@ -134,10 +124,6 @@ public void ShowInfo(GetSpotlightRankingsResponse response) participantsColumn.Value = response.Spotlight.Participants?.ToString("N0"); } - protected override void PopIn() => content.FadeIn(duration, Easing.OutQuint); - - protected override void PopOut() => content.FadeOut(duration, Easing.OutQuint); - private string dateToString(DateTimeOffset date) => date.ToString("yyyy-MM-dd"); private class InfoColumn : FillFlowContainer diff --git a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs index 0f9b07bf89..61339df76f 100644 --- a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs +++ b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs @@ -81,8 +81,6 @@ protected override void LoadComplete() { base.LoadComplete(); - selector.Show(); - selectedSpotlight.BindValueChanged(_ => onSpotlightChanged()); sort.BindValueChanged(_ => onSpotlightChanged()); Ruleset.BindValueChanged(onRulesetChanged); From ad9492804a645ea851f815b23878e4ab98211f6c Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 21 Jul 2020 22:56:44 +0300 Subject: [PATCH 060/106] Apply suggestions --- osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs index 01c13dbc97..2a76b8e265 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs @@ -37,7 +37,7 @@ public TestSceneOverlayHeader() }); addHeader("Orange OverlayHeader (no background, 100 padding)", new TestNoBackgroundHeader(), OverlayColourScheme.Orange); - addHeader("Blue OverlayHeader (default 70 padding)", new TestNoControlHeader(), OverlayColourScheme.Blue); + addHeader("Blue OverlayHeader (default 50 padding)", new TestNoControlHeader(), OverlayColourScheme.Blue); addHeader("Green TabControlOverlayHeader (string) with ruleset selector", new TestStringTabControlHeader(), OverlayColourScheme.Green); addHeader("Pink TabControlOverlayHeader (enum, 30 padding)", new TestEnumTabControlHeader(), OverlayColourScheme.Pink); addHeader("Red BreadcrumbControlOverlayHeader (no background, 10 padding)", new TestBreadcrumbControlHeader(), OverlayColourScheme.Red); diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 2895fa0726..2e5f1071f2 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -23,7 +23,7 @@ public class ProfileHeader : TabControlOverlayHeader public ProfileHeader() { - ContentSidePadding = 70; + ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN; User.ValueChanged += e => updateDisplay(e.NewValue); From cccb47e6e04e956dc4cfe73dfdff8c2bdc993526 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 11:29:23 +0900 Subject: [PATCH 061/106] Add user cover background to expanded version of score panel --- osu.Game/Screens/Ranking/ScorePanel.cs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Ranking/ScorePanel.cs b/osu.Game/Screens/Ranking/ScorePanel.cs index 9633f5c533..5da432d5b2 100644 --- a/osu.Game/Screens/Ranking/ScorePanel.cs +++ b/osu.Game/Screens/Ranking/ScorePanel.cs @@ -13,6 +13,7 @@ using osu.Game.Scoring; using osu.Game.Screens.Ranking.Contracted; using osu.Game.Screens.Ranking.Expanded; +using osu.Game.Users; using osuTK; using osuTK.Graphics; @@ -142,7 +143,16 @@ private void load() CornerRadius = 20, CornerExponent = 2.5f, Masking = true, - Child = middleLayerBackground = new Box { RelativeSizeAxes = Axes.Both } + Children = new[] + { + middleLayerBackground = new Box { RelativeSizeAxes = Axes.Both }, + new UserCoverBackground + { + RelativeSizeAxes = Axes.Both, + User = Score.User, + Colour = ColourInfo.GradientVertical(Color4.White.Opacity(0.5f), Color4Extensions.FromHex("#444").Opacity(0)) + }, + } }, middleLayerContentContainer = new Container { RelativeSizeAxes = Axes.Both } } @@ -155,18 +165,10 @@ protected override void LoadComplete() { base.LoadComplete(); - if (state == PanelState.Expanded) - { - topLayerBackground.FadeColour(expanded_top_layer_colour); - middleLayerBackground.FadeColour(expanded_middle_layer_colour); - } - else - { - topLayerBackground.FadeColour(contracted_top_layer_colour); - middleLayerBackground.FadeColour(contracted_middle_layer_colour); - } - updateState(); + + topLayerBackground.FinishTransforms(false, nameof(Colour)); + middleLayerBackground.FinishTransforms(false, nameof(Colour)); } private PanelState state = PanelState.Contracted; From aca4110e36d03568e1ca2ceadeaf3df42a41093e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Jul 2020 12:47:53 +0900 Subject: [PATCH 062/106] Use existing star difficulty if non-local beatmap/ruleset --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index b469ca78fb..d94e04a79b 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -209,7 +209,8 @@ private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, // Difficulty can only be computed if the beatmap and ruleset are locally available. if (beatmapInfo.ID == 0 || rulesetInfo.ID == null) { - existingDifficulty = new StarDifficulty(0); + // If not, fall back to the existing star difficulty (e.g. from an online source). + existingDifficulty = new StarDifficulty(beatmapInfo.StarDifficulty); key = default; return true; From 6b7f05740e51c77790295a0ba882c8b45d379bb2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Jul 2020 12:48:12 +0900 Subject: [PATCH 063/106] Fix potential missing ruleset --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index d94e04a79b..a9f34acd14 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -176,6 +176,9 @@ private BindableStarDifficulty createBindable([NotNull] BeatmapInfo beatmapInfo, /// The . private StarDifficulty computeDifficulty(in DifficultyCacheLookup key, BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo) { + // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. + rulesetInfo ??= beatmapInfo.Ruleset; + try { var ruleset = rulesetInfo.CreateInstance(); From ac602846df9d6a6be5b70672b537fe126cd0274e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 16:37:24 +0900 Subject: [PATCH 064/106] Expose balance and sample loading methods in DrawableHitObject --- .../Objects/Drawables/DrawableHitObject.cs | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index b633cb0860..f275153ce3 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -126,7 +126,7 @@ private void load(OsuConfigManager config) if (Result == null) throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}."); - loadSamples(); + LoadSamples(); } protected override void LoadComplete() @@ -145,14 +145,14 @@ protected override void LoadComplete() } samplesBindable = HitObject.SamplesBindable.GetBoundCopy(); - samplesBindable.CollectionChanged += (_, __) => loadSamples(); + samplesBindable.CollectionChanged += (_, __) => LoadSamples(); apply(HitObject); updateState(ArmedState.Idle, true); } - private void loadSamples() + protected virtual void LoadSamples() { if (Samples != null) { @@ -353,17 +353,32 @@ protected virtual void ApplySkin(ISkinSource skin, bool allowFallback) [Resolved(canBeNull: true)] private GameplayClock gameplayClock { get; set; } + /// + /// Calculate the position to be used for sample playback at a specified X position (0..1). + /// + /// The lookup X position. Generally should be . + /// + protected double CalculateSamplePlaybackBalance(double position) + { + const float balance_adjust_amount = 0.4f; + + return balance_adjust_amount * (userPositionalHitSounds.Value ? position - 0.5f : 0); + } + + /// + /// Whether samples should currently be playing. Will be false during seek operations. + /// + protected bool ShouldPlaySamples => gameplayClock?.IsSeeking != true; + /// /// Plays all the hit sounds for this . /// This is invoked automatically when this is hit. /// public virtual void PlaySamples() { - const float balance_adjust_amount = 0.4f; - - if (Samples != null && gameplayClock?.IsSeeking != true) + if (Samples != null && ShouldPlaySamples) { - Samples.Balance.Value = balance_adjust_amount * (userPositionalHitSounds.Value ? SamplePlaybackPosition - 0.5f : 0); + Samples.Balance.Value = CalculateSamplePlaybackBalance(SamplePlaybackPosition); Samples.Play(); } } From 3ed40d3a6b1fd14413920fc70208a71e4beebf99 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 16:37:53 +0900 Subject: [PATCH 065/106] Fix SkinnableSounds not continuing playback on skin change --- osu.Game/Skinning/SkinnableSound.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index 24d6648273..49f9f01cff 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -98,6 +98,8 @@ public void Play() => samplesContainer.ForEach(c => protected override void SkinChanged(ISkinSource skin, bool allowFallback) { + bool wasPlaying = samplesContainer.Any(s => s.Playing); + var channels = hitSamples.Select(s => { var ch = skin.GetSample(s); @@ -121,6 +123,9 @@ protected override void SkinChanged(ISkinSource skin, bool allowFallback) }).Where(c => c != null); samplesContainer.ChildrenEnumerable = channels.Select(c => new DrawableSample(c)); + + if (wasPlaying) + Play(); } } } From 2126f6bffc9d613706e12c4ef153c1fb7cb567ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 16:37:38 +0900 Subject: [PATCH 066/106] Add slider "sliding" sample support --- .../Objects/Drawables/DrawableSlider.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 72502c02cd..5059ec1231 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using osuTK; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; @@ -11,6 +12,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Skinning; +using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Scoring; using osuTK.Graphics; using osu.Game.Skinning; @@ -81,6 +83,41 @@ private void load() foreach (var drawableHitObject in NestedHitObjects) drawableHitObject.AccentColour.Value = colour.NewValue; }, true); + + Tracking.BindValueChanged(updateSlidingSample); + } + + private SkinnableSound slidingSample; + + protected override void LoadSamples() + { + base.LoadSamples(); + + slidingSample?.Expire(); + + var firstSample = HitObject.Samples.FirstOrDefault(); + + if (firstSample != null) + { + var clone = HitObject.SampleControlPoint.ApplyTo(firstSample); + clone.Name = "sliderslide"; + + AddInternal(slidingSample = new SkinnableSound(clone) + { + Looping = true + }); + } + } + + private void updateSlidingSample(ValueChangedEvent tracking) + { + // note that samples will not start playing if exiting a seek operation in the middle of a slider. + // may be something we want to address at a later point, but not so easy to make happen right now + // (SkinnableSound would need to expose whether the sample is already playing and this logic would need to run in Update). + if (tracking.NewValue && ShouldPlaySamples) + slidingSample?.Play(); + else + slidingSample?.Stop(); } protected override void AddNestedHitObject(DrawableHitObject hitObject) @@ -156,6 +193,10 @@ protected override void Update() Tracking.Value = Ball.Tracking; + if (Tracking.Value && slidingSample != null) + // keep the sliding sample playing at the current tracking position + slidingSample.Balance.Value = CalculateSamplePlaybackBalance(Ball.X / OsuPlayfield.BASE_SIZE.X); + double completionProgress = Math.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); Ball.UpdateProgress(completionProgress); From 0957c5f74ce0bdf1e3fc6524d18d0021780abb86 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Jul 2020 18:29:50 +0900 Subject: [PATCH 067/106] Re-namespace multiplayer requests/responses --- .../Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs | 1 - .../Requests/Responses => Multiplayer}/APICreatedRoom.cs | 3 +-- osu.Game/Online/{API => Multiplayer}/APIPlaylistBeatmap.cs | 2 +- .../{API/Requests/Responses => Multiplayer}/APIScoreToken.cs | 2 +- .../{API/Requests => Multiplayer}/CreateRoomRequest.cs | 5 ++--- .../{API/Requests => Multiplayer}/CreateRoomScoreRequest.cs | 4 ++-- .../Requests => Multiplayer}/GetRoomPlaylistScoresRequest.cs | 3 ++- .../Online/{API/Requests => Multiplayer}/GetRoomRequest.cs | 4 ++-- .../{API/Requests => Multiplayer}/GetRoomScoresRequest.cs | 3 ++- .../Online/{API/Requests => Multiplayer}/GetRoomsRequest.cs | 4 ++-- .../Online/{API/Requests => Multiplayer}/JoinRoomRequest.cs | 4 ++-- .../Online/{API/Requests => Multiplayer}/PartRoomRequest.cs | 4 ++-- osu.Game/Online/{API => Multiplayer}/RoomScore.cs | 4 ++-- .../{API/Requests => Multiplayer}/SubmitRoomScoreRequest.cs | 3 ++- osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs | 1 - osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs | 1 - osu.Game/Screens/Multi/Ranking/TimeshiftResultsScreen.cs | 1 - osu.Game/Screens/Multi/RoomManager.cs | 1 - 18 files changed, 23 insertions(+), 27 deletions(-) rename osu.Game/Online/{API/Requests/Responses => Multiplayer}/APICreatedRoom.cs (78%) rename osu.Game/Online/{API => Multiplayer}/APIPlaylistBeatmap.cs (94%) rename osu.Game/Online/{API/Requests/Responses => Multiplayer}/APIScoreToken.cs (85%) rename osu.Game/Online/{API/Requests => Multiplayer}/CreateRoomRequest.cs (86%) rename osu.Game/Online/{API/Requests => Multiplayer}/CreateRoomScoreRequest.cs (90%) rename osu.Game/Online/{API/Requests => Multiplayer}/GetRoomPlaylistScoresRequest.cs (92%) rename osu.Game/Online/{API/Requests => Multiplayer}/GetRoomRequest.cs (84%) rename osu.Game/Online/{API/Requests => Multiplayer}/GetRoomScoresRequest.cs (89%) rename osu.Game/Online/{API/Requests => Multiplayer}/GetRoomsRequest.cs (94%) rename osu.Game/Online/{API/Requests => Multiplayer}/JoinRoomRequest.cs (90%) rename osu.Game/Online/{API/Requests => Multiplayer}/PartRoomRequest.cs (90%) rename osu.Game/Online/{API => Multiplayer}/RoomScore.cs (97%) rename osu.Game/Online/{API/Requests => Multiplayer}/SubmitRoomScoreRequest.cs (95%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs index 9fc7c336cb..0da1e11fee 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using NUnit.Framework; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game/Online/API/Requests/Responses/APICreatedRoom.cs b/osu.Game/Online/Multiplayer/APICreatedRoom.cs similarity index 78% rename from osu.Game/Online/API/Requests/Responses/APICreatedRoom.cs rename to osu.Game/Online/Multiplayer/APICreatedRoom.cs index a554101bc7..2a3bb39647 100644 --- a/osu.Game/Online/API/Requests/Responses/APICreatedRoom.cs +++ b/osu.Game/Online/Multiplayer/APICreatedRoom.cs @@ -2,9 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using Newtonsoft.Json; -using osu.Game.Online.Multiplayer; -namespace osu.Game.Online.API.Requests.Responses +namespace osu.Game.Online.Multiplayer { public class APICreatedRoom : Room { diff --git a/osu.Game/Online/API/APIPlaylistBeatmap.cs b/osu.Game/Online/Multiplayer/APIPlaylistBeatmap.cs similarity index 94% rename from osu.Game/Online/API/APIPlaylistBeatmap.cs rename to osu.Game/Online/Multiplayer/APIPlaylistBeatmap.cs index 4f7786e880..98972ef36d 100644 --- a/osu.Game/Online/API/APIPlaylistBeatmap.cs +++ b/osu.Game/Online/Multiplayer/APIPlaylistBeatmap.cs @@ -6,7 +6,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; -namespace osu.Game.Online.API +namespace osu.Game.Online.Multiplayer { public class APIPlaylistBeatmap : APIBeatmap { diff --git a/osu.Game/Online/API/Requests/Responses/APIScoreToken.cs b/osu.Game/Online/Multiplayer/APIScoreToken.cs similarity index 85% rename from osu.Game/Online/API/Requests/Responses/APIScoreToken.cs rename to osu.Game/Online/Multiplayer/APIScoreToken.cs index 1d2465bedf..1f0063d94e 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScoreToken.cs +++ b/osu.Game/Online/Multiplayer/APIScoreToken.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; -namespace osu.Game.Online.API.Requests.Responses +namespace osu.Game.Online.Multiplayer { public class APIScoreToken { diff --git a/osu.Game/Online/API/Requests/CreateRoomRequest.cs b/osu.Game/Online/Multiplayer/CreateRoomRequest.cs similarity index 86% rename from osu.Game/Online/API/Requests/CreateRoomRequest.cs rename to osu.Game/Online/Multiplayer/CreateRoomRequest.cs index c848c55cc6..dcb4ed51ea 100644 --- a/osu.Game/Online/API/Requests/CreateRoomRequest.cs +++ b/osu.Game/Online/Multiplayer/CreateRoomRequest.cs @@ -4,10 +4,9 @@ using System.Net.Http; using Newtonsoft.Json; using osu.Framework.IO.Network; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Online.Multiplayer; +using osu.Game.Online.API; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class CreateRoomRequest : APIRequest { diff --git a/osu.Game/Online/API/Requests/CreateRoomScoreRequest.cs b/osu.Game/Online/Multiplayer/CreateRoomScoreRequest.cs similarity index 90% rename from osu.Game/Online/API/Requests/CreateRoomScoreRequest.cs rename to osu.Game/Online/Multiplayer/CreateRoomScoreRequest.cs index e6246b4f1f..f973f96b37 100644 --- a/osu.Game/Online/API/Requests/CreateRoomScoreRequest.cs +++ b/osu.Game/Online/Multiplayer/CreateRoomScoreRequest.cs @@ -3,9 +3,9 @@ using System.Net.Http; using osu.Framework.IO.Network; -using osu.Game.Online.API.Requests.Responses; +using osu.Game.Online.API; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class CreateRoomScoreRequest : APIRequest { diff --git a/osu.Game/Online/API/Requests/GetRoomPlaylistScoresRequest.cs b/osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs similarity index 92% rename from osu.Game/Online/API/Requests/GetRoomPlaylistScoresRequest.cs rename to osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs index 38f852870b..833a761f42 100644 --- a/osu.Game/Online/API/Requests/GetRoomPlaylistScoresRequest.cs +++ b/osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using Newtonsoft.Json; +using osu.Game.Online.API; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class GetRoomPlaylistScoresRequest : APIRequest { diff --git a/osu.Game/Online/API/Requests/GetRoomRequest.cs b/osu.Game/Online/Multiplayer/GetRoomRequest.cs similarity index 84% rename from osu.Game/Online/API/Requests/GetRoomRequest.cs rename to osu.Game/Online/Multiplayer/GetRoomRequest.cs index 531e1857de..2907b49f1d 100644 --- a/osu.Game/Online/API/Requests/GetRoomRequest.cs +++ b/osu.Game/Online/Multiplayer/GetRoomRequest.cs @@ -1,9 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Online.Multiplayer; +using osu.Game.Online.API; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class GetRoomRequest : APIRequest { diff --git a/osu.Game/Online/API/Requests/GetRoomScoresRequest.cs b/osu.Game/Online/Multiplayer/GetRoomScoresRequest.cs similarity index 89% rename from osu.Game/Online/API/Requests/GetRoomScoresRequest.cs rename to osu.Game/Online/Multiplayer/GetRoomScoresRequest.cs index eb53369d18..bc913030dd 100644 --- a/osu.Game/Online/API/Requests/GetRoomScoresRequest.cs +++ b/osu.Game/Online/Multiplayer/GetRoomScoresRequest.cs @@ -2,9 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class GetRoomScoresRequest : APIRequest> { diff --git a/osu.Game/Online/API/Requests/GetRoomsRequest.cs b/osu.Game/Online/Multiplayer/GetRoomsRequest.cs similarity index 94% rename from osu.Game/Online/API/Requests/GetRoomsRequest.cs rename to osu.Game/Online/Multiplayer/GetRoomsRequest.cs index c47ed20909..64e0386f77 100644 --- a/osu.Game/Online/API/Requests/GetRoomsRequest.cs +++ b/osu.Game/Online/Multiplayer/GetRoomsRequest.cs @@ -4,10 +4,10 @@ using System.Collections.Generic; using Humanizer; using osu.Framework.IO.Network; -using osu.Game.Online.Multiplayer; +using osu.Game.Online.API; using osu.Game.Screens.Multi.Lounge.Components; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class GetRoomsRequest : APIRequest> { diff --git a/osu.Game/Online/API/Requests/JoinRoomRequest.cs b/osu.Game/Online/Multiplayer/JoinRoomRequest.cs similarity index 90% rename from osu.Game/Online/API/Requests/JoinRoomRequest.cs rename to osu.Game/Online/Multiplayer/JoinRoomRequest.cs index b0808afa45..74375af856 100644 --- a/osu.Game/Online/API/Requests/JoinRoomRequest.cs +++ b/osu.Game/Online/Multiplayer/JoinRoomRequest.cs @@ -3,9 +3,9 @@ using System.Net.Http; using osu.Framework.IO.Network; -using osu.Game.Online.Multiplayer; +using osu.Game.Online.API; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class JoinRoomRequest : APIRequest { diff --git a/osu.Game/Online/API/Requests/PartRoomRequest.cs b/osu.Game/Online/Multiplayer/PartRoomRequest.cs similarity index 90% rename from osu.Game/Online/API/Requests/PartRoomRequest.cs rename to osu.Game/Online/Multiplayer/PartRoomRequest.cs index c988cd5c9e..54bb005d96 100644 --- a/osu.Game/Online/API/Requests/PartRoomRequest.cs +++ b/osu.Game/Online/Multiplayer/PartRoomRequest.cs @@ -3,9 +3,9 @@ using System.Net.Http; using osu.Framework.IO.Network; -using osu.Game.Online.Multiplayer; +using osu.Game.Online.API; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class PartRoomRequest : APIRequest { diff --git a/osu.Game/Online/API/RoomScore.cs b/osu.Game/Online/Multiplayer/RoomScore.cs similarity index 97% rename from osu.Game/Online/API/RoomScore.cs rename to osu.Game/Online/Multiplayer/RoomScore.cs index 3c7f8c9833..97f378856f 100644 --- a/osu.Game/Online/API/RoomScore.cs +++ b/osu.Game/Online/Multiplayer/RoomScore.cs @@ -6,13 +6,13 @@ using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using osu.Game.Online.Multiplayer; +using osu.Game.Online.API; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Users; -namespace osu.Game.Online.API +namespace osu.Game.Online.Multiplayer { public class RoomScore { diff --git a/osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs b/osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs similarity index 95% rename from osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs rename to osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs index 8eb2952159..f725ea5dc9 100644 --- a/osu.Game/Online/API/Requests/SubmitRoomScoreRequest.cs +++ b/osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs @@ -4,9 +4,10 @@ using System.Net.Http; using Newtonsoft.Json; using osu.Framework.IO.Network; +using osu.Game.Online.API; using osu.Game.Scoring; -namespace osu.Game.Online.API.Requests +namespace osu.Game.Online.Multiplayer { public class SubmitRoomScoreRequest : APIRequest { diff --git a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs index 571bbde716..1afbf5c32a 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs index cf0197d26b..c2381fe219 100644 --- a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs +++ b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs @@ -10,7 +10,6 @@ using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; using osu.Game.Scoring; diff --git a/osu.Game/Screens/Multi/Ranking/TimeshiftResultsScreen.cs b/osu.Game/Screens/Multi/Ranking/TimeshiftResultsScreen.cs index 5cafc974f1..f367d44347 100644 --- a/osu.Game/Screens/Multi/Ranking/TimeshiftResultsScreen.cs +++ b/osu.Game/Screens/Multi/Ranking/TimeshiftResultsScreen.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Online.Multiplayer; using osu.Game.Scoring; using osu.Game.Screens.Ranking; diff --git a/osu.Game/Screens/Multi/RoomManager.cs b/osu.Game/Screens/Multi/RoomManager.cs index 491be2e946..2a96fa536d 100644 --- a/osu.Game/Screens/Multi/RoomManager.cs +++ b/osu.Game/Screens/Multi/RoomManager.cs @@ -14,7 +14,6 @@ using osu.Game.Beatmaps; using osu.Game.Online; using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; using osu.Game.Screens.Multi.Lounge.Components; From e423630b7cbec15c0457089513ff0af85822591b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Jul 2020 18:37:00 +0900 Subject: [PATCH 068/106] Rename RoomScore -> MultiplayerScore --- .../Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs | 4 ++-- osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs | 2 +- .../Online/Multiplayer/{RoomScore.cs => MultiplayerScore.cs} | 2 +- osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename osu.Game/Online/Multiplayer/{RoomScore.cs => MultiplayerScore.cs} (98%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs index 0da1e11fee..0023866124 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneTimeshiftResultsScreen.cs @@ -64,11 +64,11 @@ private void createResults(ScoreInfo score) private void bindHandler(double delay = 0) { - var roomScores = new List(); + var roomScores = new List(); for (int i = 0; i < 10; i++) { - roomScores.Add(new RoomScore + roomScores.Add(new MultiplayerScore { ID = i, Accuracy = 0.9 - 0.01 * i, diff --git a/osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs b/osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs index 833a761f42..3d3bd20ff3 100644 --- a/osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs +++ b/osu.Game/Online/Multiplayer/GetRoomPlaylistScoresRequest.cs @@ -24,6 +24,6 @@ public GetRoomPlaylistScoresRequest(int roomId, int playlistItemId) public class RoomPlaylistScores { [JsonProperty("scores")] - public List Scores { get; set; } + public List Scores { get; set; } } } diff --git a/osu.Game/Online/Multiplayer/RoomScore.cs b/osu.Game/Online/Multiplayer/MultiplayerScore.cs similarity index 98% rename from osu.Game/Online/Multiplayer/RoomScore.cs rename to osu.Game/Online/Multiplayer/MultiplayerScore.cs index 97f378856f..3bbf19b11f 100644 --- a/osu.Game/Online/Multiplayer/RoomScore.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerScore.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.Multiplayer { - public class RoomScore + public class MultiplayerScore { [JsonProperty("id")] public int ID { get; set; } diff --git a/osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs b/osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs index f725ea5dc9..d31aef2ea5 100644 --- a/osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs +++ b/osu.Game/Online/Multiplayer/SubmitRoomScoreRequest.cs @@ -9,7 +9,7 @@ namespace osu.Game.Online.Multiplayer { - public class SubmitRoomScoreRequest : APIRequest + public class SubmitRoomScoreRequest : APIRequest { private readonly int scoreId; private readonly int roomId; From 53a9ac3c1aa160bd1ccd8a23aa3833bd5f014e9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 19:06:39 +0900 Subject: [PATCH 069/106] Fix slider ball rotation being applied to follow circle and specular layer --- .../Objects/Drawables/Pieces/SliderBall.cs | 18 ++++-------- .../Skinning/LegacySliderBall.cs | 28 +++++++++++++++++-- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 395c76a233..b87e112d10 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -33,7 +33,7 @@ public Color4 AccentColour private readonly Slider slider; private readonly Drawable followCircle; private readonly DrawableSlider drawableSlider; - private readonly CircularContainer ball; + private readonly Drawable ball; public SliderBall(Slider slider, DrawableSlider drawableSlider = null) { @@ -54,19 +54,11 @@ public SliderBall(Slider slider, DrawableSlider drawableSlider = null) Alpha = 0, Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderFollowCircle), _ => new DefaultFollowCircle()), }, - ball = new CircularContainer + ball = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderBall), _ => new DefaultSliderBall()) { - Masking = true, - RelativeSizeAxes = Axes.Both, - Origin = Anchor.Centre, Anchor = Anchor.Centre, - Alpha = 1, - Child = new Container - { - RelativeSizeAxes = Axes.Both, - Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderBall), _ => new DefaultSliderBall()), - } - } + Origin = Anchor.Centre, + }, }; } @@ -187,7 +179,7 @@ public void UpdateProgress(double completionProgress) return; Position = newPos; - Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI); + ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI); lastPosition = newPos; } diff --git a/osu.Game.Rulesets.Osu/Skinning/LegacySliderBall.cs b/osu.Game.Rulesets.Osu/Skinning/LegacySliderBall.cs index b4ed75d97c..0f586034d5 100644 --- a/osu.Game.Rulesets.Osu/Skinning/LegacySliderBall.cs +++ b/osu.Game.Rulesets.Osu/Skinning/LegacySliderBall.cs @@ -15,6 +15,9 @@ public class LegacySliderBall : CompositeDrawable { private readonly Drawable animationContent; + private Sprite layerNd; + private Sprite layerSpec; + public LegacySliderBall(Drawable animationContent) { this.animationContent = animationContent; @@ -29,18 +32,37 @@ private void load(ISkinSource skin, DrawableHitObject drawableObject) InternalChildren = new[] { - new Sprite + layerNd = new Sprite { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Texture = skin.GetTexture("sliderb-nd"), Colour = new Color4(5, 5, 5, 255), }, - animationContent, - new Sprite + animationContent.With(d => { + d.Anchor = Anchor.Centre; + d.Origin = Anchor.Centre; + }), + layerSpec = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Texture = skin.GetTexture("sliderb-spec"), Blending = BlendingParameters.Additive, }, }; } + + protected override void UpdateAfterChildren() + { + base.UpdateAfterChildren(); + + //undo rotation on layers which should not be rotated. + float appliedRotation = Parent.Rotation; + + layerNd.Rotation = -appliedRotation; + layerSpec.Rotation = -appliedRotation; + } } } From bd6a51f545a5121d98e57f3e8894094d3cb1e738 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 19:30:10 +0900 Subject: [PATCH 070/106] Hide slider repeat judgements temporarily --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs index 720ffcd51c..d79ecb7b4e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderRepeat.cs @@ -23,6 +23,8 @@ public class DrawableSliderRepeat : DrawableOsuHitObject, ITrackSnaking private readonly Drawable scaleContainer; + public override bool DisplayResult => false; + public DrawableSliderRepeat(SliderRepeat sliderRepeat, DrawableSlider drawableSlider) : base(sliderRepeat) { From 798bf0503818856b48f150b4598c2e01f340fdaf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 19:43:48 +0900 Subject: [PATCH 071/106] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 71d4e5aacf..c0c75b8d71 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,6 +52,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2f3d08c528..e8c333b6b1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -24,7 +24,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 2bb3914c25..8d1b837995 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -70,7 +70,7 @@ - + @@ -80,7 +80,7 @@ - + From 2c62b23d859d46b1e4f3c21ea18e8c52a910b9c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 19:53:45 +0900 Subject: [PATCH 072/106] Update naming --- .../Replays/CatchFramedReplayInputHandler.cs | 4 ++-- .../Replays/ManiaFramedReplayInputHandler.cs | 4 ++-- .../Replays/OsuFramedReplayInputHandler.cs | 15 +++------------ .../Replays/TaikoFramedReplayInputHandler.cs | 4 ++-- .../Visual/Gameplay/TestSceneReplayRecorder.cs | 2 +- .../Visual/Gameplay/TestSceneReplayRecording.cs | 2 +- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs index 24c21fbc84..99d899db80 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs @@ -35,11 +35,11 @@ protected float? Position } } - public override void GetPendingInputs(List input) + public override void CollectPendingInputs(List inputs) { if (!Position.HasValue) return; - input.Add(new CatchReplayState + inputs.Add(new CatchReplayState { PressedActions = CurrentFrame?.Actions ?? new List(), CatcherX = Position.Value diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs index 26c4ccf289..aa0c148caf 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs @@ -18,9 +18,9 @@ public ManiaFramedReplayInputHandler(Replay replay) protected override bool IsImportant(ManiaReplayFrame frame) => frame.Actions.Any(); - public override void GetPendingInputs(List input) + public override void CollectPendingInputs(List inputs) { - input.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); + inputs.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); } } } diff --git a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs index 5c803539c2..cf48dc053f 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs @@ -36,19 +36,10 @@ protected Vector2? Position } } - public override void GetPendingInputs(List input) + public override void CollectPendingInputs(List inputs) { - input.Add( - new MousePositionAbsoluteInput - { - Position = GamefieldToScreenSpace(Position ?? Vector2.Zero) - }); - input.Add( - new ReplayState - { - PressedActions = CurrentFrame?.Actions ?? new List() - }); - ; + inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(Position ?? Vector2.Zero) }); + inputs.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); } } } diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs index 7361d4efa8..138e8f9785 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -18,9 +18,9 @@ public TaikoFramedReplayInputHandler(Replay replay) protected override bool IsImportant(TaikoReplayFrame frame) => frame.Actions.Any(); - public override void GetPendingInputs(List input) + public override void CollectPendingInputs(List inputs) { - input.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); + inputs.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); } } } diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs index e473f49826..bc1c10e59d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecorder.cs @@ -173,7 +173,7 @@ public TestFramedReplayInputHandler(Replay replay) { } - public override void GetPendingInputs(List inputs) + public override void CollectPendingInputs(List inputs) { inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) }); inputs.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs index e891ed617a..c0f99db85d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs @@ -113,7 +113,7 @@ public TestFramedReplayInputHandler(Replay replay) { } - public override void GetPendingInputs(List inputs) + public override void CollectPendingInputs(List inputs) { inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) }); inputs.Add(new ReplayState { PressedActions = CurrentFrame?.Actions ?? new List() }); From 113fac84ddf195b10d1ae3a9b1cd1e437c94d0ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jul 2020 21:14:04 +0900 Subject: [PATCH 073/106] Fix circle container type --- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index b87e112d10..07dc6021c9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -184,7 +184,7 @@ public void UpdateProgress(double completionProgress) lastPosition = newPos; } - private class FollowCircleContainer : Container + private class FollowCircleContainer : CircularContainer { public override bool HandlePositionalInput => true; } From 50f72ac9cb90074f647d76085b515d4ce8d9b45d Mon Sep 17 00:00:00 2001 From: jorolf Date: Wed, 22 Jul 2020 22:10:59 +0200 Subject: [PATCH 074/106] rename classes --- ...neHueAnimation.cs => TestSceneLogoAnimation.cs} | 10 +++++----- .../Sprites/{HueAnimation.cs => LogoAnimation.cs} | 14 +++++++------- osu.Game/Screens/Menu/IntroTriangles.cs | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) rename osu.Game.Tests/Visual/UserInterface/{TestSceneHueAnimation.cs => TestSceneLogoAnimation.cs} (85%) rename osu.Game/Graphics/Sprites/{HueAnimation.cs => LogoAnimation.cs} (79%) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs similarity index 85% rename from osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs index 9c5888d072..155d043bf9 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneHueAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoAnimation.cs @@ -11,14 +11,14 @@ namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] - public class TestSceneHueAnimation : OsuTestScene + public class TestSceneLogoAnimation : OsuTestScene { [BackgroundDependencyLoader] private void load(LargeTextureStore textures) { - HueAnimation anim2; + LogoAnimation anim2; - Add(anim2 = new HueAnimation + Add(anim2 = new LogoAnimation { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, @@ -26,9 +26,9 @@ private void load(LargeTextureStore textures) Colour = Colour4.White, }); - HueAnimation anim; + LogoAnimation anim; - Add(anim = new HueAnimation + Add(anim = new LogoAnimation { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, diff --git a/osu.Game/Graphics/Sprites/HueAnimation.cs b/osu.Game/Graphics/Sprites/LogoAnimation.cs similarity index 79% rename from osu.Game/Graphics/Sprites/HueAnimation.cs rename to osu.Game/Graphics/Sprites/LogoAnimation.cs index 8ad68ace05..b1383065fe 100644 --- a/osu.Game/Graphics/Sprites/HueAnimation.cs +++ b/osu.Game/Graphics/Sprites/LogoAnimation.cs @@ -11,13 +11,13 @@ namespace osu.Game.Graphics.Sprites { - public class HueAnimation : Sprite + public class LogoAnimation : Sprite { [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) { - TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation"); - RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation"); // Masking isn't supported for now + TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); + RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); // Masking isn't supported for now } private float animationProgress; @@ -36,15 +36,15 @@ public float AnimationProgress public override bool IsPresent => true; - protected override DrawNode CreateDrawNode() => new HueAnimationDrawNode(this); + protected override DrawNode CreateDrawNode() => new LogoAnimationDrawNode(this); - private class HueAnimationDrawNode : SpriteDrawNode + private class LogoAnimationDrawNode : SpriteDrawNode { - private HueAnimation source => (HueAnimation)Source; + private LogoAnimation source => (LogoAnimation)Source; private float progress; - public HueAnimationDrawNode(HueAnimation source) + public LogoAnimationDrawNode(LogoAnimation source) : base(source) { } diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index b56ba6c8a4..a9ef20436f 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -260,7 +260,7 @@ protected override void LoadComplete() private class LazerLogo : CompositeDrawable { - private HueAnimation highlight, background; + private LogoAnimation highlight, background; public float Progress { @@ -282,13 +282,13 @@ private void load(TextureStore textures) { InternalChildren = new Drawable[] { - highlight = new HueAnimation + highlight = new LogoAnimation { RelativeSizeAxes = Axes.Both, Texture = textures.Get(@"Intro/Triangles/logo-highlight"), Colour = Color4.White, }, - background = new HueAnimation + background = new LogoAnimation { RelativeSizeAxes = Axes.Both, Texture = textures.Get(@"Intro/Triangles/logo-background"), From 4102dae999cb7f63294b033898885d50afbc799b Mon Sep 17 00:00:00 2001 From: Lucas A Date: Wed, 22 Jul 2020 21:45:27 +0200 Subject: [PATCH 075/106] Revert commit 939441ae --- osu.Desktop/Windows/GameplayWinKeyHandler.cs | 14 +++++++------- osu.Game/Configuration/SessionStatics.cs | 4 +--- osu.Game/Screens/Play/Player.cs | 2 +- .../Screens/Play/ScreenSuspensionHandler.cs | 19 ++----------------- 4 files changed, 11 insertions(+), 28 deletions(-) diff --git a/osu.Desktop/Windows/GameplayWinKeyHandler.cs b/osu.Desktop/Windows/GameplayWinKeyHandler.cs index d5ef89c680..4f74a4f492 100644 --- a/osu.Desktop/Windows/GameplayWinKeyHandler.cs +++ b/osu.Desktop/Windows/GameplayWinKeyHandler.cs @@ -11,26 +11,26 @@ namespace osu.Desktop.Windows { public class GameplayWinKeyHandler : Component { + private Bindable allowScreenSuspension; private Bindable disableWinKey; - private Bindable disableWinKeySetting; private GameHost host; [BackgroundDependencyLoader] - private void load(GameHost host, OsuConfigManager config, SessionStatics statics) + private void load(GameHost host, OsuConfigManager config) { this.host = host; - disableWinKey = statics.GetBindable(Static.DisableWindowsKey); - disableWinKey.ValueChanged += toggleWinKey; + allowScreenSuspension = host.AllowScreenSuspension.GetBoundCopy(); + allowScreenSuspension.ValueChanged += toggleWinKey; - disableWinKeySetting = config.GetBindable(OsuSetting.GameplayDisableWinKey); - disableWinKeySetting.BindValueChanged(t => disableWinKey.TriggerChange(), true); + disableWinKey = config.GetBindable(OsuSetting.GameplayDisableWinKey); + disableWinKey.BindValueChanged(t => allowScreenSuspension.TriggerChange(), true); } private void toggleWinKey(ValueChangedEvent e) { - if (e.NewValue && disableWinKeySetting.Value) + if (!e.NewValue && disableWinKey.Value) host.InputThread.Scheduler.Add(WindowsKey.Disable); else host.InputThread.Scheduler.Add(WindowsKey.Enable); diff --git a/osu.Game/Configuration/SessionStatics.cs b/osu.Game/Configuration/SessionStatics.cs index 7aad79b5ad..40b2adb867 100644 --- a/osu.Game/Configuration/SessionStatics.cs +++ b/osu.Game/Configuration/SessionStatics.cs @@ -12,14 +12,12 @@ protected override void InitialiseDefaults() { Set(Static.LoginOverlayDisplayed, false); Set(Static.MutedAudioNotificationShownOnce, false); - Set(Static.DisableWindowsKey, false); } } public enum Static { LoginOverlayDisplayed, - MutedAudioNotificationShownOnce, - DisableWindowsKey + MutedAudioNotificationShownOnce } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e0721d55f7..541275cf55 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -181,7 +181,7 @@ private void load(AudioManager audio, OsuConfigManager config) InternalChild = GameplayClockContainer = new GameplayClockContainer(Beatmap.Value, Mods.Value, DrawableRuleset.GameplayStartTime); AddInternal(gameplayBeatmap = new GameplayBeatmap(playableBeatmap)); - AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer, DrawableRuleset.HasReplayLoaded)); + AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer)); dependencies.CacheAs(gameplayBeatmap); diff --git a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs index 6865db5a5e..8585a5c309 100644 --- a/osu.Game/Screens/Play/ScreenSuspensionHandler.cs +++ b/osu.Game/Screens/Play/ScreenSuspensionHandler.cs @@ -8,7 +8,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Platform; -using osu.Game.Configuration; namespace osu.Game.Screens.Play { @@ -19,18 +18,13 @@ public class ScreenSuspensionHandler : Component { private readonly GameplayClockContainer gameplayClockContainer; private Bindable isPaused; - private readonly Bindable hasReplayLoaded; [Resolved] private GameHost host { get; set; } - [Resolved] - private SessionStatics statics { get; set; } - - public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer, Bindable hasReplayLoaded) + public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer) { this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer)); - this.hasReplayLoaded = hasReplayLoaded.GetBoundCopy(); } protected override void LoadComplete() @@ -42,12 +36,7 @@ protected override void LoadComplete() Debug.Assert(host.AllowScreenSuspension.Value); isPaused = gameplayClockContainer.IsPaused.GetBoundCopy(); - isPaused.BindValueChanged(paused => - { - host.AllowScreenSuspension.Value = paused.NewValue; - statics.Set(Static.DisableWindowsKey, !paused.NewValue && !hasReplayLoaded.Value); - }, true); - hasReplayLoaded.BindValueChanged(_ => isPaused.TriggerChange(), true); + isPaused.BindValueChanged(paused => host.AllowScreenSuspension.Value = paused.NewValue, true); } protected override void Dispose(bool isDisposing) @@ -55,13 +44,9 @@ protected override void Dispose(bool isDisposing) base.Dispose(isDisposing); isPaused?.UnbindAll(); - hasReplayLoaded.UnbindAll(); if (host != null) - { host.AllowScreenSuspension.Value = true; - statics.Set(Static.DisableWindowsKey, false); - } } } } From acff270e969cde58d12893fc891351d3d06afdbd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jul 2020 19:14:18 +0900 Subject: [PATCH 076/106] Fix failing test by moving slider closer --- osu.Game.Rulesets.Osu.Tests/TestSceneOutOfOrderHits.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOutOfOrderHits.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOutOfOrderHits.cs index c3b4d2625e..854626d362 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneOutOfOrderHits.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOutOfOrderHits.cs @@ -223,7 +223,7 @@ public void TestHitSliderTicksBeforeCircle() const double time_slider = 1500; const double time_circle = 1510; Vector2 positionCircle = Vector2.Zero; - Vector2 positionSlider = new Vector2(80); + Vector2 positionSlider = new Vector2(30); var hitObjects = new List { From 5e6adfff99b1b348897ab4606aef7f910016560c Mon Sep 17 00:00:00 2001 From: Lucas A Date: Thu, 23 Jul 2020 12:45:14 +0200 Subject: [PATCH 077/106] Disable windows key only while in gameplay. --- osu.Desktop/OsuGameDesktop.cs | 2 +- osu.Desktop/Windows/GameplayWinKeyHandler.cs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index d05a4af126..6eefee3b50 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -101,7 +101,7 @@ protected override void LoadComplete() LoadComponentAsync(new DiscordRichPresence(), Add); if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) - LoadComponentAsync(new GameplayWinKeyHandler(), Add); + LoadComponentAsync(new GameplayWinKeyHandler(ScreenStack), Add); } protected override void ScreenChanged(IScreen lastScreen, IScreen newScreen) diff --git a/osu.Desktop/Windows/GameplayWinKeyHandler.cs b/osu.Desktop/Windows/GameplayWinKeyHandler.cs index 4f74a4f492..96154356d0 100644 --- a/osu.Desktop/Windows/GameplayWinKeyHandler.cs +++ b/osu.Desktop/Windows/GameplayWinKeyHandler.cs @@ -1,11 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Game.Configuration; +using osu.Game.Screens; +using osu.Game.Screens.Play; namespace osu.Desktop.Windows { @@ -14,8 +17,16 @@ public class GameplayWinKeyHandler : Component private Bindable allowScreenSuspension; private Bindable disableWinKey; + private readonly OsuScreenStack screenStack; private GameHost host; + private Type currentScreenType => screenStack.CurrentScreen?.GetType(); + + public GameplayWinKeyHandler(OsuScreenStack stack) + { + screenStack = stack; + } + [BackgroundDependencyLoader] private void load(GameHost host, OsuConfigManager config) { @@ -30,7 +41,9 @@ private void load(GameHost host, OsuConfigManager config) private void toggleWinKey(ValueChangedEvent e) { - if (!e.NewValue && disableWinKey.Value) + var isPlayer = typeof(Player).IsAssignableFrom(currentScreenType) && currentScreenType != typeof(ReplayPlayer); + + if (!e.NewValue && disableWinKey.Value && isPlayer) host.InputThread.Scheduler.Add(WindowsKey.Disable); else host.InputThread.Scheduler.Add(WindowsKey.Enable); From f883cb85d72ff2f98ec87a1f207e239b805e2c8b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 Jul 2020 21:24:31 +0900 Subject: [PATCH 078/106] Null out the sample too --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 5059ec1231..07f40f763b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -94,6 +94,7 @@ protected override void LoadSamples() base.LoadSamples(); slidingSample?.Expire(); + slidingSample = null; var firstSample = HitObject.Samples.FirstOrDefault(); From d0b35d7b32895ff3f988c0f6e85fa86eaacaad0f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Jul 2020 22:13:37 +0900 Subject: [PATCH 079/106] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index c0c75b8d71..e5b0245dd0 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,6 +52,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e8c333b6b1..5af28ae11a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -24,7 +24,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 8d1b837995..4a94ec33d8 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -70,7 +70,7 @@ - + @@ -80,7 +80,7 @@ - + From 76284a0f018f2c8c3a502db24360081e0c1f5996 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 Jul 2020 23:18:43 +0900 Subject: [PATCH 080/106] Move cancellation out of condition --- .../Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index d5aeecae04..1b5b448e1f 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -188,12 +188,11 @@ protected override void ApplyState() if (Item.State.Value != CarouselItemState.Collapsed && Alpha == 0) starCounter.ReplayAnimation(); - if (Item.State.Value == CarouselItemState.Collapsed) - starDifficultyCancellationSource?.Cancel(); - else - { - starDifficultyCancellationSource?.Cancel(); + starDifficultyCancellationSource?.Cancel(); + // Only compute difficulty when the item is visible. + if (Item.State.Value != CarouselItemState.Collapsed) + { // We've potentially cancelled the computation above so a new bindable is required. starDifficultyBindable = difficultyManager.GetTrackedBindable(beatmap, (starDifficultyCancellationSource = new CancellationTokenSource()).Token); starDifficultyBindable.BindValueChanged(d => starCounter.Current = (float)d.NewValue.Stars, true); From f75f1231b7f2300b260e25e7dc8f2d4d273b2bc7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jul 2020 10:41:09 +0900 Subject: [PATCH 081/106] Invert conditional for readability --- osu.Game/Graphics/Cursor/MenuCursorContainer.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs index 02bfb3fad6..3015c44613 100644 --- a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs @@ -58,10 +58,11 @@ protected override void Update() foreach (var d in inputManager.HoveredDrawables) { - if (!(d is IProvideCursor p) || !p.ProvidingUserCursor) continue; - - newTarget = p; - break; + if (d is IProvideCursor p && p.ProvidingUserCursor) + { + newTarget = p; + break; + } } if (currentTarget == newTarget) From 264bd7ced1c8a8caab663eebba2114bfefa766a9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Jul 2020 13:38:53 +0900 Subject: [PATCH 082/106] Apply general refactoring from review --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index a9f34acd14..12d472e8c6 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -24,7 +24,7 @@ public class BeatmapDifficultyManager : CompositeDrawable // Too many simultaneous updates can lead to stutters. One thread seems to work fine for song select display purposes. private readonly ThreadedTaskScheduler updateScheduler = new ThreadedTaskScheduler(1, nameof(BeatmapDifficultyManager)); - // A cache that keeps references to BeatmapInfos for 60sec. + // A permanent cache to prevent re-computations. private readonly ConcurrentDictionary difficultyCache = new ConcurrentDictionary(); // All bindables that should be updated along with the current ruleset + mods. @@ -48,29 +48,29 @@ protected override void LoadComplete() } /// - /// Retrieves an containing the star difficulty of a with a given and combination. + /// Retrieves a bindable containing the star difficulty of a with a given and combination. /// /// - /// This will not update to follow the currently-selected ruleset and mods. + /// The bindable will not update to follow the currently-selected ruleset and mods. /// /// The to get the difficulty of. /// The to get the difficulty with. /// The s to get the difficulty with. /// An optional which stops updating the star difficulty for the given . - /// An that is updated to contain the star difficulty when it becomes available. + /// A bindable that is updated to contain the star difficulty when it becomes available. public IBindable GetUntrackedBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, CancellationToken cancellationToken = default) => createBindable(beatmapInfo, rulesetInfo, mods, cancellationToken); /// - /// Retrieves a containing the star difficulty of a that follows the user's currently-selected ruleset and mods. + /// Retrieves a bindable containing the star difficulty of a that follows the user's currently-selected ruleset and mods. /// /// - /// Ensure to hold a local reference of the returned in order to receive value-changed events. + /// Ensure to hold a local reference of the returned bindable in order to receive value-changed events. /// /// The to get the difficulty of. /// An optional which stops updating the star difficulty for the given . - /// An that is updated to contain the star difficulty when it becomes available, or when the currently-selected ruleset and mods change. + /// A bindable that is updated to contain the star difficulty when it becomes available, or when the currently-selected ruleset and mods change. public IBindable GetTrackedBindable([NotNull] BeatmapInfo beatmapInfo, CancellationToken cancellationToken = default) { var bindable = createBindable(beatmapInfo, currentRuleset.Value, currentMods.Value, cancellationToken); @@ -89,7 +89,7 @@ public IBindable GetTrackedBindable([NotNull] BeatmapInfo beatma public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, CancellationToken cancellationToken = default) { - if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) + if (tryGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; return await Task.Factory.StartNew(() => computeDifficulty(key, beatmapInfo, rulesetInfo), cancellationToken, @@ -105,7 +105,7 @@ public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatm /// The . public StarDifficulty GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null) { - if (tryGetGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) + if (tryGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; return computeDifficulty(key, beatmapInfo, rulesetInfo); @@ -204,7 +204,7 @@ private StarDifficulty computeDifficulty(in DifficultyCacheLookup key, BeatmapIn /// The existing difficulty value, if present. /// The key that was used to perform this lookup. This can be further used to query . /// Whether an existing difficulty was found. - private bool tryGetGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IReadOnlyList mods, out StarDifficulty existingDifficulty, out DifficultyCacheLookup key) + private bool tryGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IReadOnlyList mods, out StarDifficulty existingDifficulty, out DifficultyCacheLookup key) { // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. rulesetInfo ??= beatmapInfo.Ruleset; From de007cc1c63da3bd88ee52881a31f8cce91c2ec0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Jul 2020 13:40:01 +0900 Subject: [PATCH 083/106] Use IEnumerable mods instead of IReadOnlyList --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index 12d472e8c6..914874e210 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -58,7 +58,7 @@ protected override void LoadComplete() /// The s to get the difficulty with. /// An optional which stops updating the star difficulty for the given . /// A bindable that is updated to contain the star difficulty when it becomes available. - public IBindable GetUntrackedBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, + public IBindable GetUntrackedBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IEnumerable mods = null, CancellationToken cancellationToken = default) => createBindable(beatmapInfo, rulesetInfo, mods, cancellationToken); @@ -86,7 +86,7 @@ public IBindable GetTrackedBindable([NotNull] BeatmapInfo beatma /// The s to get the difficulty with. /// An optional which stops computing the star difficulty. /// The . - public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null, + public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IEnumerable mods = null, CancellationToken cancellationToken = default) { if (tryGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) @@ -103,7 +103,7 @@ public async Task GetDifficultyAsync([NotNull] BeatmapInfo beatm /// The to get the difficulty with. /// The s to get the difficulty with. /// The . - public StarDifficulty GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IReadOnlyList mods = null) + public StarDifficulty GetDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IEnumerable mods = null) { if (tryGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key)) return existing; @@ -138,7 +138,7 @@ private void updateTrackedBindables() /// The to update with. /// The s to update with. /// A token that may be used to cancel this update. - private void updateBindable([NotNull] BindableStarDifficulty bindable, [CanBeNull] RulesetInfo rulesetInfo, [CanBeNull] IReadOnlyList mods, CancellationToken cancellationToken = default) + private void updateBindable([NotNull] BindableStarDifficulty bindable, [CanBeNull] RulesetInfo rulesetInfo, [CanBeNull] IEnumerable mods, CancellationToken cancellationToken = default) { GetDifficultyAsync(bindable.Beatmap, rulesetInfo, mods, cancellationToken).ContinueWith(t => { @@ -159,7 +159,7 @@ private void updateBindable([NotNull] BindableStarDifficulty bindable, [CanBeNul /// The initial s to get the difficulty with. /// An optional which stops updating the star difficulty for the given . /// The . - private BindableStarDifficulty createBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo initialRulesetInfo, [CanBeNull] IReadOnlyList initialMods, + private BindableStarDifficulty createBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo initialRulesetInfo, [CanBeNull] IEnumerable initialMods, CancellationToken cancellationToken) { var bindable = new BindableStarDifficulty(beatmapInfo, cancellationToken); @@ -204,7 +204,7 @@ private StarDifficulty computeDifficulty(in DifficultyCacheLookup key, BeatmapIn /// The existing difficulty value, if present. /// The key that was used to perform this lookup. This can be further used to query . /// Whether an existing difficulty was found. - private bool tryGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IReadOnlyList mods, out StarDifficulty existingDifficulty, out DifficultyCacheLookup key) + private bool tryGetExisting(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo, IEnumerable mods, out StarDifficulty existingDifficulty, out DifficultyCacheLookup key) { // In the case that the user hasn't given us a ruleset, use the beatmap's default ruleset. rulesetInfo ??= beatmapInfo.Ruleset; From b10b99a6703c9a68d2f1da1b013a46460548a988 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Jul 2020 13:52:43 +0900 Subject: [PATCH 084/106] Change method signatures to remove tracked/untracked --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 37 +++++++++---------- .../Carousel/DrawableCarouselBeatmap.cs | 2 +- .../Screens/Select/Details/AdvancedStats.cs | 4 +- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index 914874e210..d86c0dd945 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -47,6 +47,19 @@ protected override void LoadComplete() currentMods.BindValueChanged(_ => updateTrackedBindables(), true); } + /// + /// Retrieves a bindable containing the star difficulty of a that follows the currently-selected ruleset and mods. + /// + /// The to get the difficulty of. + /// An optional which stops updating the star difficulty for the given . + /// A bindable that is updated to contain the star difficulty when it becomes available. + public IBindable GetBindableDifficulty([NotNull] BeatmapInfo beatmapInfo, CancellationToken cancellationToken = default) + { + var bindable = createBindable(beatmapInfo, currentRuleset.Value, currentMods.Value, cancellationToken); + trackedBindables.Add(bindable); + return bindable; + } + /// /// Retrieves a bindable containing the star difficulty of a with a given and combination. /// @@ -54,30 +67,14 @@ protected override void LoadComplete() /// The bindable will not update to follow the currently-selected ruleset and mods. /// /// The to get the difficulty of. - /// The to get the difficulty with. - /// The s to get the difficulty with. + /// The to get the difficulty with. If null, the difficulty will change along with the game-wide ruleset and mods. + /// The s to get the difficulty with. If null, the difficulty will change along with the game-wide mods. /// An optional which stops updating the star difficulty for the given . /// A bindable that is updated to contain the star difficulty when it becomes available. - public IBindable GetUntrackedBindable([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo = null, [CanBeNull] IEnumerable mods = null, - CancellationToken cancellationToken = default) + public IBindable GetBindableDifficulty([NotNull] BeatmapInfo beatmapInfo, [NotNull] RulesetInfo rulesetInfo, [CanBeNull] IEnumerable mods, + CancellationToken cancellationToken = default) => createBindable(beatmapInfo, rulesetInfo, mods, cancellationToken); - /// - /// Retrieves a bindable containing the star difficulty of a that follows the user's currently-selected ruleset and mods. - /// - /// - /// Ensure to hold a local reference of the returned bindable in order to receive value-changed events. - /// - /// The to get the difficulty of. - /// An optional which stops updating the star difficulty for the given . - /// A bindable that is updated to contain the star difficulty when it becomes available, or when the currently-selected ruleset and mods change. - public IBindable GetTrackedBindable([NotNull] BeatmapInfo beatmapInfo, CancellationToken cancellationToken = default) - { - var bindable = createBindable(beatmapInfo, currentRuleset.Value, currentMods.Value, cancellationToken); - trackedBindables.Add(bindable); - return bindable; - } - /// /// Retrieves the difficulty of a . /// diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 1b5b448e1f..c559b4f8f5 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -194,7 +194,7 @@ protected override void ApplyState() if (Item.State.Value != CarouselItemState.Collapsed) { // We've potentially cancelled the computation above so a new bindable is required. - starDifficultyBindable = difficultyManager.GetTrackedBindable(beatmap, (starDifficultyCancellationSource = new CancellationTokenSource()).Token); + starDifficultyBindable = difficultyManager.GetBindableDifficulty(beatmap, (starDifficultyCancellationSource = new CancellationTokenSource()).Token); starDifficultyBindable.BindValueChanged(d => starCounter.Current = (float)d.NewValue.Stars, true); } diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index aefba397b9..1557a025ef 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -161,8 +161,8 @@ private void updateStarDifficulty() var ourSource = starDifficultyCancellationSource = new CancellationTokenSource(); - normalStarDifficulty = difficultyManager.GetUntrackedBindable(Beatmap, ruleset.Value, cancellationToken: ourSource.Token); - moddedStarDifficulty = difficultyManager.GetUntrackedBindable(Beatmap, ruleset.Value, mods.Value, ourSource.Token); + normalStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, null, cancellationToken: ourSource.Token); + moddedStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, mods.Value, ourSource.Token); normalStarDifficulty.BindValueChanged(_ => updateDisplay()); moddedStarDifficulty.BindValueChanged(_ => updateDisplay(), true); From 44b0aae20d753f707065d21cf9d25da7b52936c3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Jul 2020 13:54:47 +0900 Subject: [PATCH 085/106] Allow nullable ruleset, reword xmldoc --- osu.Game/Beatmaps/BeatmapDifficultyManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs index d86c0dd945..5e644fbf1c 100644 --- a/osu.Game/Beatmaps/BeatmapDifficultyManager.cs +++ b/osu.Game/Beatmaps/BeatmapDifficultyManager.cs @@ -67,11 +67,11 @@ public IBindable GetBindableDifficulty([NotNull] BeatmapInfo bea /// The bindable will not update to follow the currently-selected ruleset and mods. /// /// The to get the difficulty of. - /// The to get the difficulty with. If null, the difficulty will change along with the game-wide ruleset and mods. - /// The s to get the difficulty with. If null, the difficulty will change along with the game-wide mods. + /// The to get the difficulty with. If null, the 's ruleset is used. + /// The s to get the difficulty with. If null, no mods will be assumed. /// An optional which stops updating the star difficulty for the given . /// A bindable that is updated to contain the star difficulty when it becomes available. - public IBindable GetBindableDifficulty([NotNull] BeatmapInfo beatmapInfo, [NotNull] RulesetInfo rulesetInfo, [CanBeNull] IEnumerable mods, + public IBindable GetBindableDifficulty([NotNull] BeatmapInfo beatmapInfo, [CanBeNull] RulesetInfo rulesetInfo, [CanBeNull] IEnumerable mods, CancellationToken cancellationToken = default) => createBindable(beatmapInfo, rulesetInfo, mods, cancellationToken); From d093dc09f94a194eb8e1d936c7ccf36b3a1ff712 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jul 2020 14:10:05 +0900 Subject: [PATCH 086/106] Limit notification text length to avoid large error messages degrading performance --- osu.Game/OsuGame.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f4bb10340e..d6a07651e2 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -18,6 +18,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Humanizer; using JetBrains.Annotations; using osu.Framework.Audio; using osu.Framework.Bindables; @@ -759,7 +760,7 @@ private void forwardLoggedErrorsToNotifications() Schedule(() => notifications.Post(new SimpleNotification { Icon = entry.Level == LogLevel.Important ? FontAwesome.Solid.ExclamationCircle : FontAwesome.Solid.Bomb, - Text = entry.Message + (entry.Exception != null && IsDeployedBuild ? "\n\nThis error has been automatically reported to the devs." : string.Empty), + Text = entry.Message.Truncate(256) + (entry.Exception != null && IsDeployedBuild ? "\n\nThis error has been automatically reported to the devs." : string.Empty), })); } else if (recentLogCount == short_term_display_limit) From 4e0f16a45059996dd0ac01ef70cf6bace62b70a7 Mon Sep 17 00:00:00 2001 From: Poliwrath Date: Fri, 24 Jul 2020 02:00:18 -0400 Subject: [PATCH 087/106] Add JPEG screenshot quality setting --- osu.Game/Configuration/OsuConfigManager.cs | 2 ++ osu.Game/Graphics/ScreenshotManager.cs | 5 ++++- .../Overlays/Settings/Sections/Graphics/DetailSettings.cs | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 268328272c..a45f5994b7 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -106,6 +106,7 @@ protected override void InitialiseDefaults() Set(OsuSetting.Version, string.Empty); Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg); + Set(OsuSetting.ScreenshotJpegQuality, 75, 0, 100); Set(OsuSetting.ScreenshotCaptureMenuCursor, false); Set(OsuSetting.SongSelectRightMouseScroll, false); @@ -212,6 +213,7 @@ public enum OsuSetting ShowConvertedBeatmaps, Skin, ScreenshotFormat, + ScreenshotJpegQuality, ScreenshotCaptureMenuCursor, SongSelectRightMouseScroll, BeatmapSkins, diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 9804aefce8..091e206a80 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -19,6 +19,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using SixLabors.ImageSharp; +using SixLabors.ImageSharp.Formats.Jpeg; namespace osu.Game.Graphics { @@ -33,6 +34,7 @@ public class ScreenshotManager : Component, IKeyBindingHandler, IH public IBindable CursorVisibility => cursorVisibility; private Bindable screenshotFormat; + private Bindable screenshotJpegQuality; private Bindable captureMenuCursor; [Resolved] @@ -51,6 +53,7 @@ private void load(OsuConfigManager config, Storage storage, AudioManager audio) this.storage = storage.GetStorageForDirectory(@"screenshots"); screenshotFormat = config.GetBindable(OsuSetting.ScreenshotFormat); + screenshotJpegQuality = config.GetBindable(OsuSetting.ScreenshotJpegQuality); captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); shutter = audio.Samples.Get("UI/shutter"); @@ -119,7 +122,7 @@ public Task TakeScreenshotAsync() => Task.Run(async () => break; case ScreenshotFormat.Jpg: - image.SaveAsJpeg(stream); + image.SaveAsJpeg(stream, new JpegEncoder { Quality = screenshotJpegQuality.Value }); break; default: diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs index 3089040f96..8b783fb104 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs @@ -31,6 +31,11 @@ private void load(OsuConfigManager config) LabelText = "Screenshot format", Bindable = config.GetBindable(OsuSetting.ScreenshotFormat) }, + new SettingsSlider + { + LabelText = "JPEG Screenshot quality", + Bindable = config.GetBindable(OsuSetting.ScreenshotJpegQuality) + }, new SettingsCheckbox { LabelText = "Show menu cursor in screenshots", From 05235c70c53186c5b3bceca9d8ad3963463ee9ec Mon Sep 17 00:00:00 2001 From: Poliwrath Date: Fri, 24 Jul 2020 02:26:45 -0400 Subject: [PATCH 088/106] remove jpeg quality setting, use 92 for quality --- osu.Game/Configuration/OsuConfigManager.cs | 2 -- osu.Game/Graphics/ScreenshotManager.cs | 6 +++--- .../Overlays/Settings/Sections/Graphics/DetailSettings.cs | 5 ----- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index a45f5994b7..268328272c 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -106,7 +106,6 @@ protected override void InitialiseDefaults() Set(OsuSetting.Version, string.Empty); Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg); - Set(OsuSetting.ScreenshotJpegQuality, 75, 0, 100); Set(OsuSetting.ScreenshotCaptureMenuCursor, false); Set(OsuSetting.SongSelectRightMouseScroll, false); @@ -213,7 +212,6 @@ public enum OsuSetting ShowConvertedBeatmaps, Skin, ScreenshotFormat, - ScreenshotJpegQuality, ScreenshotCaptureMenuCursor, SongSelectRightMouseScroll, BeatmapSkins, diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 091e206a80..d1f6fd445e 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -34,7 +34,6 @@ public class ScreenshotManager : Component, IKeyBindingHandler, IH public IBindable CursorVisibility => cursorVisibility; private Bindable screenshotFormat; - private Bindable screenshotJpegQuality; private Bindable captureMenuCursor; [Resolved] @@ -53,7 +52,6 @@ private void load(OsuConfigManager config, Storage storage, AudioManager audio) this.storage = storage.GetStorageForDirectory(@"screenshots"); screenshotFormat = config.GetBindable(OsuSetting.ScreenshotFormat); - screenshotJpegQuality = config.GetBindable(OsuSetting.ScreenshotJpegQuality); captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); shutter = audio.Samples.Get("UI/shutter"); @@ -122,7 +120,9 @@ public Task TakeScreenshotAsync() => Task.Run(async () => break; case ScreenshotFormat.Jpg: - image.SaveAsJpeg(stream, new JpegEncoder { Quality = screenshotJpegQuality.Value }); + const int jpeg_quality = 92; + + image.SaveAsJpeg(stream, new JpegEncoder { Quality = jpeg_quality }); break; default: diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs index 8b783fb104..3089040f96 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs @@ -31,11 +31,6 @@ private void load(OsuConfigManager config) LabelText = "Screenshot format", Bindable = config.GetBindable(OsuSetting.ScreenshotFormat) }, - new SettingsSlider - { - LabelText = "JPEG Screenshot quality", - Bindable = config.GetBindable(OsuSetting.ScreenshotJpegQuality) - }, new SettingsCheckbox { LabelText = "Show menu cursor in screenshots", From 877b985e900a1c4669e04dcb16f47f760232aafd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Jul 2020 16:11:28 +0900 Subject: [PATCH 089/106] Remove local cancellation token --- osu.Game/Screens/Select/Details/AdvancedStats.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 1557a025ef..44c328187f 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -159,10 +159,10 @@ private void updateStarDifficulty() if (Beatmap == null) return; - var ourSource = starDifficultyCancellationSource = new CancellationTokenSource(); + starDifficultyCancellationSource = new CancellationTokenSource(); - normalStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, null, cancellationToken: ourSource.Token); - moddedStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, mods.Value, ourSource.Token); + normalStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, null, starDifficultyCancellationSource.Token); + moddedStarDifficulty = difficultyManager.GetBindableDifficulty(Beatmap, ruleset.Value, mods.Value, starDifficultyCancellationSource.Token); normalStarDifficulty.BindValueChanged(_ => updateDisplay()); moddedStarDifficulty.BindValueChanged(_ => updateDisplay(), true); From dbe9180c55c4e4d6a8991b76aa48a9a4b5f46674 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jul 2020 16:38:48 +0900 Subject: [PATCH 090/106] Rename class and remove screen conditionals --- osu.Desktop/OsuGameDesktop.cs | 2 +- ...KeyHandler.cs => GameplayWinKeyBlocker.cs} | 23 +++++-------------- osu.Desktop/Windows/WindowsKey.cs | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) rename osu.Desktop/Windows/{GameplayWinKeyHandler.cs => GameplayWinKeyBlocker.cs} (55%) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 6eefee3b50..2079f136d2 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -101,7 +101,7 @@ protected override void LoadComplete() LoadComponentAsync(new DiscordRichPresence(), Add); if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) - LoadComponentAsync(new GameplayWinKeyHandler(ScreenStack), Add); + LoadComponentAsync(new GameplayWinKeyBlocker(), Add); } protected override void ScreenChanged(IScreen lastScreen, IScreen newScreen) diff --git a/osu.Desktop/Windows/GameplayWinKeyHandler.cs b/osu.Desktop/Windows/GameplayWinKeyBlocker.cs similarity index 55% rename from osu.Desktop/Windows/GameplayWinKeyHandler.cs rename to osu.Desktop/Windows/GameplayWinKeyBlocker.cs index 96154356d0..86174ceb90 100644 --- a/osu.Desktop/Windows/GameplayWinKeyHandler.cs +++ b/osu.Desktop/Windows/GameplayWinKeyBlocker.cs @@ -1,49 +1,38 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Game.Configuration; -using osu.Game.Screens; -using osu.Game.Screens.Play; namespace osu.Desktop.Windows { - public class GameplayWinKeyHandler : Component + public class GameplayWinKeyBlocker : Component { private Bindable allowScreenSuspension; private Bindable disableWinKey; - private readonly OsuScreenStack screenStack; private GameHost host; - private Type currentScreenType => screenStack.CurrentScreen?.GetType(); - - public GameplayWinKeyHandler(OsuScreenStack stack) - { - screenStack = stack; - } - [BackgroundDependencyLoader] private void load(GameHost host, OsuConfigManager config) { this.host = host; allowScreenSuspension = host.AllowScreenSuspension.GetBoundCopy(); - allowScreenSuspension.ValueChanged += toggleWinKey; + allowScreenSuspension.BindValueChanged(_ => updateBlocking()); disableWinKey = config.GetBindable(OsuSetting.GameplayDisableWinKey); - disableWinKey.BindValueChanged(t => allowScreenSuspension.TriggerChange(), true); + disableWinKey.BindValueChanged(_ => updateBlocking(), true); } - private void toggleWinKey(ValueChangedEvent e) + private void updateBlocking() { - var isPlayer = typeof(Player).IsAssignableFrom(currentScreenType) && currentScreenType != typeof(ReplayPlayer); + bool shouldDisable = disableWinKey.Value && !allowScreenSuspension.Value; - if (!e.NewValue && disableWinKey.Value && isPlayer) + if (shouldDisable) host.InputThread.Scheduler.Add(WindowsKey.Disable); else host.InputThread.Scheduler.Add(WindowsKey.Enable); diff --git a/osu.Desktop/Windows/WindowsKey.cs b/osu.Desktop/Windows/WindowsKey.cs index 4a815b135e..f19d741107 100644 --- a/osu.Desktop/Windows/WindowsKey.cs +++ b/osu.Desktop/Windows/WindowsKey.cs @@ -21,7 +21,7 @@ internal class WindowsKey private static IntPtr keyHook; [StructLayout(LayoutKind.Explicit)] - private struct KdDllHookStruct + private readonly struct KdDllHookStruct { [FieldOffset(0)] public readonly int VkCode; From 5f98195144d1068063bfd015d2501255afcd0a34 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Jul 2020 18:16:36 +0900 Subject: [PATCH 091/106] Load nested hitobjects during map load --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index f275153ce3..581617b567 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -129,9 +129,9 @@ private void load(OsuConfigManager config) LoadSamples(); } - protected override void LoadComplete() + protected override void LoadAsyncComplete() { - base.LoadComplete(); + base.LoadAsyncComplete(); HitObject.DefaultsApplied += onDefaultsApplied; @@ -148,6 +148,11 @@ protected override void LoadComplete() samplesBindable.CollectionChanged += (_, __) => LoadSamples(); apply(HitObject); + } + + protected override void LoadComplete() + { + base.LoadComplete(); updateState(ArmedState.Idle, true); } From 2b068298cc339f3134662331037569cf08b18cd3 Mon Sep 17 00:00:00 2001 From: bastoo0 <37190278+bastoo0@users.noreply.github.com> Date: Fri, 24 Jul 2020 12:01:23 +0200 Subject: [PATCH 092/106] Fix inconsistency between this and osu-performance The bonus value for HD is given twice here (probably a merge issue). The correct bonus is currently used on stable: https://github.com/ppy/osu-performance/blob/736515a0347ba909d5ac303df7051b600f6655be/src/performance/catch/CatchScore.cpp#L68 --- osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs index 2ee7cea645..d700f79e5b 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchPerformanceCalculator.cs @@ -78,7 +78,6 @@ public override double Calculate(Dictionary categoryDifficulty = if (mods.Any(m => m is ModHidden)) { - value *= 1.05 + 0.075 * (10.0 - Math.Min(10.0, Attributes.ApproachRate)); // 7.5% for each AR below 10 // Hiddens gives almost nothing on max approach rate, and more the lower it is if (approachRate <= 10.0) value *= 1.05 + 0.075 * (10.0 - approachRate); // 7.5% for each AR below 10 From 8f841b47e68ea251a6bd7ec832007d8e50220d11 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Jul 2020 19:24:20 +0900 Subject: [PATCH 093/106] Cancel previous initial state computations --- .../Scrolling/ScrollingHitObjectContainer.cs | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 0dc3324559..bf64175468 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -2,11 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Layout; +using osu.Framework.Threading; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; using osuTK; @@ -17,7 +19,7 @@ public class ScrollingHitObjectContainer : HitObjectContainer { private readonly IBindable timeRange = new BindableDouble(); private readonly IBindable direction = new Bindable(); - private readonly Dictionary hitObjectInitialStateCache = new Dictionary(); + private readonly Dictionary hitObjectInitialStateCache = new Dictionary(); [Resolved] private IScrollingInfo scrollingInfo { get; set; } @@ -175,10 +177,10 @@ private void onDefaultsApplied(DrawableHitObject drawableObject) { // The cache may not exist if the hitobject state hasn't been computed yet (e.g. if the hitobject was added + defaults applied in the same frame). // In such a case, combinedObjCache will take care of updating the hitobject. - if (hitObjectInitialStateCache.TryGetValue(drawableObject, out var objCache)) + if (hitObjectInitialStateCache.TryGetValue(drawableObject, out var state)) { combinedObjCache.Invalidate(); - objCache.Invalidate(); + state.Cache.Invalidate(); } } @@ -190,8 +192,8 @@ protected override void Update() if (!layoutCache.IsValid) { - foreach (var cached in hitObjectInitialStateCache.Values) - cached.Invalidate(); + foreach (var state in hitObjectInitialStateCache.Values) + state.Cache.Invalidate(); combinedObjCache.Invalidate(); scrollingInfo.Algorithm.Reset(); @@ -215,16 +217,18 @@ protected override void Update() foreach (var obj in Objects) { - if (!hitObjectInitialStateCache.TryGetValue(obj, out var objCache)) - objCache = hitObjectInitialStateCache[obj] = new Cached(); + if (!hitObjectInitialStateCache.TryGetValue(obj, out var state)) + state = hitObjectInitialStateCache[obj] = new InitialState(new Cached()); - if (objCache.IsValid) + if (state.Cache.IsValid) continue; - computeLifetimeStartRecursive(obj); - computeInitialStateRecursive(obj); + state.ScheduledComputation?.Cancel(); + state.ScheduledComputation = computeInitialStateRecursive(obj); - objCache.Validate(); + computeLifetimeStartRecursive(obj); + + state.Cache.Validate(); } combinedObjCache.Validate(); @@ -267,8 +271,7 @@ private double computeOriginAdjustedLifetimeStart(DrawableHitObject hitObject) return scrollingInfo.Algorithm.GetDisplayStartTime(hitObject.HitObject.StartTime, originAdjustment, timeRange.Value, scrollLength); } - // Cant use AddOnce() since the delegate is re-constructed every invocation - private void computeInitialStateRecursive(DrawableHitObject hitObject) => hitObject.Schedule(() => + private ScheduledDelegate computeInitialStateRecursive(DrawableHitObject hitObject) => hitObject.Schedule(() => { if (hitObject.HitObject is IHasDuration e) { @@ -325,5 +328,19 @@ private void updatePosition(DrawableHitObject hitObject, double currentTime) break; } } + + private class InitialState + { + [NotNull] + public readonly Cached Cache; + + [CanBeNull] + public ScheduledDelegate ScheduledComputation; + + public InitialState(Cached cache) + { + Cache = cache; + } + } } } From eb84f2503657fe5c8332e18c20ac9b0281d45d87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jul 2020 19:34:13 +0900 Subject: [PATCH 094/106] Adjust maximum spins to roughly match stable --- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 1c30058d5d..9699ab9502 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -26,7 +26,10 @@ public double EndTime /// public int SpinsRequired { get; protected set; } = 1; - public int MaximumBonusSpins => SpinsRequired; + /// + /// Number of spins available to give bonus, beyond . + /// + public int MaximumBonusSpins => (int)(SpinsRequired * 1.8f); // roughly matches stable protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { From 82e4050fddb27908c282a5f307f62b22ef62940c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jul 2020 19:41:34 +0900 Subject: [PATCH 095/106] Fix xmldoc --- .../Objects/Drawables/Pieces/SpinnerBonusDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs index 76d7f1843e..a8f5580735 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBonusDisplay.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { /// - /// A component that tracks spinner spins and add bonus score for it. + /// Shows incremental bonus score achieved for a spinner. /// public class SpinnerBonusDisplay : CompositeDrawable { From dd45f0bd40d7aad6def77ce95ed2d2013cd03082 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jul 2020 21:03:55 +0900 Subject: [PATCH 096/106] Adjust max spins to "match" stable --- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 9699ab9502..2c03e6eeac 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -29,16 +29,21 @@ public double EndTime /// /// Number of spins available to give bonus, beyond . /// - public int MaximumBonusSpins => (int)(SpinsRequired * 1.8f); // roughly matches stable + public int MaximumBonusSpins { get; protected set; } = 1; protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); - SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5)); + double secondsDuration = Duration / 1000; // spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being. - SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6); + double minimumRotationsPerSecond = 0.6 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); + + const double maximum_rotations_per_second = 8; // close to 477rpm. + + SpinsRequired = (int)Math.Max(1, (secondsDuration * minimumRotationsPerSecond)); + MaximumBonusSpins = (int)(maximum_rotations_per_second / minimumRotationsPerSecond * secondsDuration); } protected override void CreateNestedHitObjects() From a6a7961af9c2788202055efff6a9e42cfd3a7344 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Jul 2020 22:09:25 +0900 Subject: [PATCH 097/106] Change div to subtraction to fix calculation --- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 2c03e6eeac..619b49926e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -35,15 +35,18 @@ protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, B { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); + // spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being. + const double stable_matching_fudge = 0.6; + + // close to 477rpm + const double maximum_rotations_per_second = 8; + double secondsDuration = Duration / 1000; - // spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being. - double minimumRotationsPerSecond = 0.6 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); - - const double maximum_rotations_per_second = 8; // close to 477rpm. + double minimumRotationsPerSecond = stable_matching_fudge * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); SpinsRequired = (int)Math.Max(1, (secondsDuration * minimumRotationsPerSecond)); - MaximumBonusSpins = (int)(maximum_rotations_per_second / minimumRotationsPerSecond * secondsDuration); + MaximumBonusSpins = (int)((maximum_rotations_per_second - minimumRotationsPerSecond) * secondsDuration); } protected override void CreateNestedHitObjects() From 897ab4a9bb2de4b5ffd2cbb9510cd74c758cfc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 25 Jul 2020 11:53:38 +0200 Subject: [PATCH 098/106] Add example test resources to demonstrate fail case --- .../Resources/special-skin/pippidonclear.png | Bin 0 -> 8462 bytes .../Resources/special-skin/pippidonfail.png | Bin 0 -> 10643 bytes .../Resources/special-skin/pippidonidle.png | Bin 0 -> 10090 bytes .../Resources/special-skin/pippidonkiai.png | Bin 0 -> 12368 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonclear.png create mode 100644 osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonfail.png create mode 100644 osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonidle.png create mode 100644 osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonkiai.png diff --git a/osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonclear.png b/osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonclear.png new file mode 100644 index 0000000000000000000000000000000000000000..c5bcdbd3fc13b3ca847cfba5402c2db38cd962c7 GIT binary patch literal 8462 zcmaKSby$<%ANBwV0nyQo4iKp!As{I^5D+DY#Ky%T+gm^cFw0i=Q{WOL_dE9yG71S4g!I0sjDgLfItKS*AE#9Fyb2+ z?+Ltax~LhsgFqD2*AKz)Y|uF{$mF2{_t14ldU#v7*?_#gy`gqa_U={|E;dkSH`@%H z3^NFH7o@JNpy!jhHS3#Z>KWLzdwe`IS*3KJ=|&jWy(dVVCLxy|8A1D}5IuYT{LfDn ztV>@-RMmf6Fr$4AMyrg3)!nVB(I+5QxG|%4FTGwg^agc!iS<1$>kM_==~06E-M%t! zTyv{CF2L+p`~ExW)Vsw*^4xM~U)6 zhw2QikagRYj=Rj}BQ;m^AP)lbBXV5)B)z#ThW%JyvJ~Y&H}D!|xK!5piO$0lTHBsd zA+V1yr5;cueYdwC^-q5Yvv)UBwV!86lO%^yoH(t2BZ6j%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0dbaNnUbP^_aF%FZGRVjc+auv2~|WObyQ$x-FD*zC30ZmdKK zC=dA`pE_e;b_Eg(2k6wY@0&c5^49LNfl|LyW%$a%H(H2a?YlDaECq?UJYUtM>)5o* z^mlDc9hi#J)9ER|K4rS5#Y#%%!T@qNx@`g=cafX}OKGwp)4>~*hz5ZDb(o&)tpCBP zW$o@FPbhoW%kWFs6-jm1_aH5;6|06_$!0w`T|R!o@HeG7)XBXqf$)eTtF+$?6ige- zPRh=mYX9x@uToUv;&Tgq$>6(GHIWUdxyf*L*;YrnQEj?vK^^crsm0 dB@$lU{>@2V|M+AC4X6fES9zvfp=ciVe*ngBauomo literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonfail.png b/osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonfail.png new file mode 100644 index 0000000000000000000000000000000000000000..39cf7372851ff962b02d9184fd9169faf06c702b GIT binary patch literal 10643 zcmXY1bzGBQ7au)(qooJZoyusWTRJ2L(jwh013^jzDe01u5D=sp-6$a;BHbyS@5Ar& z{_%Xa-RIt&y64<;&-X-YYbp`qQR9I?AVL*oc^wc4jr-vNV*?|8LGfO|2d=BKu?Gl* zPxA1f{agsX0R|s=Dj0d{y4ZU9Alz+0K0ZFY4zHa&tP!p@ye{r`pY|oFK_EtuioC3z zZ|2^Dk1v_m9nRsoo%fT7$939;;oy?cH<({b8{a9BoSbmqaNAKnm+vvx64R2b$#UPG zJ+03A(Og@jLS_te#*mdE##dHKBr!pEX#RJ3E1Nh{Z0FN1)SUC{--X2P?(XoXYCrK) zaZDIBJ3H@wQI}{`N2@1Yw7l|TMJCd7&^W1lv}HUFgt!Ac6yzy+a>NdDdwbWyAhVDs zeSp>h+D6k0D|wghLsFfT<}H}_<`H>DBp$Z2oy$mM=I}5b>{<<9mvIVBe)IbaUZ;8% z??&5B+;IUTHhKb-r4=>0C4Vp%?bI2@Oh@-l=S;4Ev*q%sIeuG0d8zS=>r;s`jCb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!#%_L3&-+Ca=tIm0vFgUXD+8~aN1!V^8@@cL)JfOy+Gu3>G z3**}#wIV(Fij;E)M7a2!mY(dPJD*$9e<^H@B*DIJ)%>lekx0t$Q0MEa*U0fQONT84 zu}0Yu^_a#h_!hp)-)~-EZsjqOi87mC>rnHE%l8!k1Y?n_T%XgpYNq75d6Xax>4qGx zSm7L3kNk;p4jAv>q|^U-@5RTBCNW4&aF8-KF0icjC;8+r`-6k3;NpkARQw4*=^#%+ zO0P{$>u`mqNmr%~h0EaJG8T7iL22NiZ2P@<7UDqGh= z!yEh-h4Q8E+C!n=St@?oUFHVY6W-lRRU1HL9SZ-PmjdqC8tMb zCu_c{b{Pj9cWfk>I-yj)l@|Rq-Y3q3}P=TXZ03;+r0PcoENC0>(rk=Xx+ITvib4)J* zwI67p_M_E`=V^*jEAe|NU;<4rRjtBST}gmNktaP{G6dS$>!k0h@`&9&!qKTE;6186NcPnLq(g2SB0wi$tI}M<>dRc4>w! ziM=B?;Myb0R8&9R3}3(i()_>WJI4K6LYApp>h@NGeanBer7g*{rr85;VDMGXs`&{N z&qpx>Id$BEySk1fD{0cV0<4l^c4UM=(as=C%v@Z;o zQ6A6T9>?v8oAABBN#@v#KvP2_L9WSEea8P+J@xgyLztn4`}2;sK;DHshn%@I_+%Km zYG6szClE^e1@9|c9{6`lMDa8;(;G;eb7$_Gb z;9oLGHCUl^u}RZ9uz6sErQ;gJZ3$vO?Zo_HZ# lb+vR*$^SLjecAt(n29rSl-gJS1gMk4Qc=*9FO#+W@IRs?%IE+9 literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonkiai.png b/osu.Game.Rulesets.Taiko.Tests/Resources/special-skin/pippidonkiai.png new file mode 100644 index 0000000000000000000000000000000000000000..7de00b5390494b7406e7595de865a8d6a659adcb GIT binary patch literal 12368 zcma)jRa}%&w>KdnD4j|pIh4|kgh)3G&Cm_fA)vz064D{ffOK~wUBXD0G(*aObbJr* z`<;t(cP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exless mascot texture lookups --- .../Skinning/TaikoLegacySkinTransformer.cs | 5 +---- osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Skinning/TaikoLegacySkinTransformer.cs b/osu.Game.Rulesets.Taiko/Skinning/TaikoLegacySkinTransformer.cs index 23d675cfb0..f032c5f485 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/TaikoLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/TaikoLegacySkinTransformer.cs @@ -91,10 +91,7 @@ public override Drawable GetDrawableComponent(ISkinComponent component) return null; case TaikoSkinComponents.Mascot: - if (GetTexture("pippidonclear0") != null) - return new DrawableTaikoMascot(); - - return null; + return new DrawableTaikoMascot(); } return Source.GetDrawableComponent(component); diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs index 6f25a5f662..9c76aea54c 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs @@ -128,6 +128,13 @@ private void load(ISkinSource skin) } private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex) - => skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}"); + { + var texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}"); + + if (frameIndex == 0 && texture == null) + texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}"); + + return texture; + } } } From f7a330becd68780ddbb91543350eee87b15d15a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 25 Jul 2020 12:13:19 +0200 Subject: [PATCH 100/106] Fix tests failing due to not checking state early enough --- .../Skinning/TestSceneDrawableTaikoMascot.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs index cb6a0decde..47d8a5c012 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableTaikoMascot.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Animations; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -36,6 +37,10 @@ public class TestSceneDrawableTaikoMascot : TaikoSkinnableTestScene private TaikoScoreProcessor scoreProcessor; private IEnumerable mascots => this.ChildrenOfType(); + + private IEnumerable animatedMascots => + mascots.Where(mascot => mascot.ChildrenOfType().All(animation => animation.FrameCount > 0)); + private IEnumerable playfields => this.ChildrenOfType(); [SetUp] @@ -72,11 +77,11 @@ public void TestClearStateTransition() AddStep("set clear state", () => mascots.ForEach(mascot => mascot.State.Value = TaikoMascotAnimationState.Clear)); AddStep("miss", () => mascots.ForEach(mascot => mascot.LastResult.Value = new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Miss })); - AddAssert("skins with animations remain in clear state", () => someMascotsIn(TaikoMascotAnimationState.Clear)); + AddAssert("skins with animations remain in clear state", () => animatedMascotsIn(TaikoMascotAnimationState.Clear)); AddUntilStep("state reverts to fail", () => allMascotsIn(TaikoMascotAnimationState.Fail)); AddStep("set clear state again", () => mascots.ForEach(mascot => mascot.State.Value = TaikoMascotAnimationState.Clear)); - AddAssert("skins with animations change to clear", () => someMascotsIn(TaikoMascotAnimationState.Clear)); + AddAssert("skins with animations change to clear", () => animatedMascotsIn(TaikoMascotAnimationState.Clear)); } [Test] @@ -186,10 +191,18 @@ private void createDrawableRuleset() private void assertStateAfterResult(JudgementResult judgementResult, TaikoMascotAnimationState expectedState) { - AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}", - () => applyNewResult(judgementResult)); + TaikoMascotAnimationState[] mascotStates = null; - AddAssert($"state is {expectedState.ToString().ToLower()}", () => allMascotsIn(expectedState)); + AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}", + () => + { + applyNewResult(judgementResult); + // store the states as soon as possible, so that the delay between steps doesn't incorrectly fail the test + // due to not checking if the state changed quickly enough. + Schedule(() => mascotStates = animatedMascots.Select(mascot => mascot.State.Value).ToArray()); + }); + + AddAssert($"state is {expectedState.ToString().ToLower()}", () => mascotStates.All(state => state == expectedState)); } private void applyNewResult(JudgementResult judgementResult) @@ -211,6 +224,6 @@ private void applyNewResult(JudgementResult judgementResult) } private bool allMascotsIn(TaikoMascotAnimationState state) => mascots.All(d => d.State.Value == state); - private bool someMascotsIn(TaikoMascotAnimationState state) => mascots.Any(d => d.State.Value == state); + private bool animatedMascotsIn(TaikoMascotAnimationState state) => animatedMascots.Any(d => d.State.Value == state); } } From 648f9204f5c59a992080f7bd9d9777a4852ce7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 26 Jul 2020 15:09:12 +0200 Subject: [PATCH 101/106] Add sample lifetime constraints for taiko --- .../Audio/DrumSampleContainer.cs | 64 +++++++++++++++++++ .../Audio/DrumSampleMapping.cs | 52 --------------- .../Skinning/LegacyInputDrum.cs | 4 +- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 10 +-- osu.Game/Skinning/SkinnableSound.cs | 3 + 5 files changed, 74 insertions(+), 59 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Audio/DrumSampleContainer.cs delete mode 100644 osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleContainer.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleContainer.cs new file mode 100644 index 0000000000..7c39c040b1 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleContainer.cs @@ -0,0 +1,64 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using osu.Framework.Graphics.Containers; +using osu.Game.Audio; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Skinning; + +namespace osu.Game.Rulesets.Taiko.Audio +{ + /// + /// Stores samples for the input drum. + /// The lifetime of the samples is adjusted so that they are only alive during the appropriate sample control point. + /// + public class DrumSampleContainer : LifetimeManagementContainer + { + private readonly ControlPointInfo controlPoints; + private readonly Dictionary mappings = new Dictionary(); + + public DrumSampleContainer(ControlPointInfo controlPoints) + { + this.controlPoints = controlPoints; + + IReadOnlyList samplePoints = controlPoints.SamplePoints.Count == 0 ? new[] { controlPoints.SamplePointAt(double.MinValue) } : controlPoints.SamplePoints; + + for (int i = 0; i < samplePoints.Count; i++) + { + var samplePoint = samplePoints[i]; + + var centre = samplePoint.GetSampleInfo(); + var rim = samplePoint.GetSampleInfo(HitSampleInfo.HIT_CLAP); + + var lifetimeStart = i > 0 ? samplePoint.Time : double.MinValue; + var lifetimeEnd = i + 1 < samplePoints.Count ? samplePoints[i + 1].Time : double.MaxValue; + + mappings[samplePoint.Time] = new DrumSample + { + Centre = addSound(centre, lifetimeStart, lifetimeEnd), + Rim = addSound(rim, lifetimeStart, lifetimeEnd) + }; + } + } + + private SkinnableSound addSound(HitSampleInfo hitSampleInfo, double lifetimeStart, double lifetimeEnd) + { + var drawable = new SkinnableSound(hitSampleInfo) + { + LifetimeStart = lifetimeStart, + LifetimeEnd = lifetimeEnd + }; + AddInternal(drawable); + return drawable; + } + + public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time).Time]; + + public class DrumSample + { + public SkinnableSound Centre; + public SkinnableSound Rim; + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs deleted file mode 100644 index c31b07344d..0000000000 --- a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.Collections.Generic; -using osu.Game.Audio; -using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Skinning; - -namespace osu.Game.Rulesets.Taiko.Audio -{ - public class DrumSampleMapping - { - private readonly ControlPointInfo controlPoints; - private readonly Dictionary mappings = new Dictionary(); - - public readonly List Sounds = new List(); - - public DrumSampleMapping(ControlPointInfo controlPoints) - { - this.controlPoints = controlPoints; - - IEnumerable samplePoints = controlPoints.SamplePoints.Count == 0 ? new[] { controlPoints.SamplePointAt(double.MinValue) } : controlPoints.SamplePoints; - - foreach (var s in samplePoints) - { - var centre = s.GetSampleInfo(); - var rim = s.GetSampleInfo(HitSampleInfo.HIT_CLAP); - - mappings[s.Time] = new DrumSample - { - Centre = addSound(centre), - Rim = addSound(rim) - }; - } - } - - private SkinnableSound addSound(HitSampleInfo hitSampleInfo) - { - var drawable = new SkinnableSound(hitSampleInfo); - Sounds.Add(drawable); - return drawable; - } - - public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time).Time]; - - public class DrumSample - { - public SkinnableSound Centre; - public SkinnableSound Rim; - } - } -} diff --git a/osu.Game.Rulesets.Taiko/Skinning/LegacyInputDrum.cs b/osu.Game.Rulesets.Taiko/Skinning/LegacyInputDrum.cs index 81d645e294..b7b55b9ae0 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/LegacyInputDrum.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/LegacyInputDrum.cs @@ -111,7 +111,7 @@ private class LegacyHalfDrum : Container, IKeyBindingHandler public readonly Sprite Centre; [Resolved] - private DrumSampleMapping sampleMappings { get; set; } + private DrumSampleContainer sampleContainer { get; set; } public LegacyHalfDrum(bool flipped) { @@ -143,7 +143,7 @@ private void load(ISkinSource skin) public bool OnPressed(TaikoAction action) { Drawable target = null; - var drumSample = sampleMappings.SampleAt(Time.Current); + var drumSample = sampleContainer.SampleAt(Time.Current); if (action == CentreAction) { diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 06ccd45cb8..f76f3d851a 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -25,11 +25,11 @@ internal class InputDrum : Container private const float middle_split = 0.025f; [Cached] - private DrumSampleMapping sampleMapping; + private DrumSampleContainer sampleContainer; public InputDrum(ControlPointInfo controlPoints) { - sampleMapping = new DrumSampleMapping(controlPoints); + sampleContainer = new DrumSampleContainer(controlPoints); RelativeSizeAxes = Axes.Both; } @@ -69,7 +69,7 @@ private void load() } }); - AddRangeInternal(sampleMapping.Sounds); + AddRangeInternal(sampleContainer.Sounds); } /// @@ -93,7 +93,7 @@ private class TaikoHalfDrum : Container, IKeyBindingHandler private readonly Sprite centreHit; [Resolved] - private DrumSampleMapping sampleMappings { get; set; } + private DrumSampleContainer sampleContainer { get; set; } public TaikoHalfDrum(bool flipped) { @@ -154,7 +154,7 @@ public bool OnPressed(TaikoAction action) Drawable target = null; Drawable back = null; - var drumSample = sampleMappings.SampleAt(Time.Current); + var drumSample = sampleContainer.SampleAt(Time.Current); if (action == CentreAction) { diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index 49f9f01cff..fb9cab74c8 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -22,6 +22,9 @@ public class SkinnableSound : SkinReloadableDrawable [Resolved] private ISampleStore samples { get; set; } + public override bool RemoveWhenNotAlive => false; + public override bool RemoveCompletedTransforms => false; + public SkinnableSound(ISampleInfo hitSamples) : this(new[] { hitSamples }) { From 8e6a0493b4f972f2d577c91b0f8cecfd6a74ba8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 26 Jul 2020 15:15:01 +0200 Subject: [PATCH 102/106] Adjust InputDrum usage --- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 60 +++++++++++++------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index f76f3d851a..5966b24b34 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -37,39 +37,41 @@ public InputDrum(ControlPointInfo controlPoints) [BackgroundDependencyLoader] private void load() { - Child = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.InputDrum), _ => new Container + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - Scale = new Vector2(0.9f), - Children = new Drawable[] + new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.InputDrum), _ => new Container { - new TaikoHalfDrum(false) + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Scale = new Vector2(0.9f), + Children = new Drawable[] { - Name = "Left Half", - Anchor = Anchor.Centre, - Origin = Anchor.CentreRight, - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = -middle_split / 2, - RimAction = TaikoAction.LeftRim, - CentreAction = TaikoAction.LeftCentre - }, - new TaikoHalfDrum(true) - { - Name = "Right Half", - Anchor = Anchor.Centre, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.Both, - RelativePositionAxes = Axes.X, - X = middle_split / 2, - RimAction = TaikoAction.RightRim, - CentreAction = TaikoAction.RightCentre + new TaikoHalfDrum(false) + { + Name = "Left Half", + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = -middle_split / 2, + RimAction = TaikoAction.LeftRim, + CentreAction = TaikoAction.LeftCentre + }, + new TaikoHalfDrum(true) + { + Name = "Right Half", + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, + X = middle_split / 2, + RimAction = TaikoAction.RightRim, + CentreAction = TaikoAction.RightCentre + } } - } - }); - - AddRangeInternal(sampleContainer.Sounds); + }), + sampleContainer + }; } /// From c78c346b627e7fa89ea99c44a521216812ed5012 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jul 2020 14:11:01 +0900 Subject: [PATCH 103/106] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index e5b0245dd0..7e6f1469f5 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5af28ae11a..ab434def38 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -25,7 +25,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 4a94ec33d8..618de5d19f 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -71,7 +71,7 @@ - + From 5e7237bf567cb5cf1539acb1d6ef05427a490b5a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 27 Jul 2020 10:29:16 +0300 Subject: [PATCH 104/106] Fix incorrect default hitcircle font overlapping applied to legacy skins --- osu.Game.Rulesets.Osu/Skinning/OsuLegacySkinTransformer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/OsuLegacySkinTransformer.cs index 3e5758ca01..95ef2d58b1 100644 --- a/osu.Game.Rulesets.Osu/Skinning/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/OsuLegacySkinTransformer.cs @@ -92,7 +92,7 @@ public override Drawable GetDrawableComponent(ISkinComponent component) case OsuSkinComponents.HitCircleText: var font = GetConfig(OsuSkinConfiguration.HitCirclePrefix)?.Value ?? "default"; - var overlap = GetConfig(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? 0; + var overlap = GetConfig(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? -2; return !hasFont(font) ? null From abdbeafc8ad4f52274ae1b65f29034f2fe676f2d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2020 17:21:15 +0000 Subject: [PATCH 105/106] Bump Sentry from 2.1.4 to 2.1.5 Bumps [Sentry](https://github.com/getsentry/sentry-dotnet) from 2.1.4 to 2.1.5. - [Release notes](https://github.com/getsentry/sentry-dotnet/releases) - [Commits](https://github.com/getsentry/sentry-dotnet/compare/2.1.4...2.1.5) Signed-off-by: dependabot-preview[bot] --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ab434def38..7ebffc6d10 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -26,7 +26,7 @@ - + From df3e2cc640ca60f5118927f43f67e71b1e0f69b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jul 2020 12:08:15 +0900 Subject: [PATCH 106/106] Fix potential crash due to cross-thread TrackVirtualManual.Stop --- osu.Game/Tests/Visual/OsuTestScene.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index cb9ed40b00..866fc215d6 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -305,8 +305,10 @@ protected override void UpdateState() { double refTime = referenceClock.CurrentTime; - if (lastReferenceTime.HasValue) - accumulated += (refTime - lastReferenceTime.Value) * Rate; + double? lastRefTime = lastReferenceTime; + + if (lastRefTime != null) + accumulated += (refTime - lastRefTime.Value) * Rate; lastReferenceTime = refTime; }