From bf0150bab4670d05e3112e24db50d29ac1c814ce Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Thu, 9 Sep 2021 16:21:51 -0400 Subject: [PATCH 01/12] Clear UR bar display on keyboard input --- .../HUD/HitErrorMeters/BarHitErrorMeter.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 89f61785e8..5998c1b494 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -10,7 +10,9 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Bindings; using osu.Game.Graphics; +using osu.Game.Input.Bindings; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; @@ -18,7 +20,7 @@ using osuTK.Graphics; namespace osu.Game.Screens.Play.HUD.HitErrorMeters { - public class BarHitErrorMeter : HitErrorMeter + public class BarHitErrorMeter : HitErrorMeter, IKeyBindingHandler { private const int arrow_move_duration = 400; @@ -279,5 +281,22 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters this.FadeTo(0.8f, 150).Then().FadeOut(judgement_fade_duration).Expire(); } } + + public bool OnPressed(GlobalAction action) + { + switch (action) + { + case GlobalAction.SeekReplayBackward: + case GlobalAction.SeekReplayForward: + judgementsContainer.Clear(true); + return false; + } + + return false; + } + + public void OnReleased(GlobalAction action) + { + } } } From bde092f816c3e9570d54e7484baca3877ef0a7d1 Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Thu, 9 Sep 2021 20:08:16 -0400 Subject: [PATCH 02/12] Clear UR bar display on seek with mouse --- .../Play/HUD/HitErrorMeters/BarHitErrorMeter.cs | 12 +++++++++++- osu.Game/Screens/Play/SongProgress.cs | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 5998c1b494..2854fabbae 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; +using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Input.Bindings; using osu.Game.Rulesets.Judgements; @@ -143,6 +144,10 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters arrow.Alpha = 0; arrow.Delay(200).FadeInFromZero(600); + + var progressBar = Parent.ChildrenOfType().FirstOrDefault(); + if (progressBar != null) + progressBar.Bar.OnSeek += _ => handleSeek(); } private void createColourBars(OsuColour colours) @@ -282,13 +287,18 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } + private void handleSeek() + { + judgementsContainer.Clear(true); + } + public bool OnPressed(GlobalAction action) { switch (action) { case GlobalAction.SeekReplayBackward: case GlobalAction.SeekReplayForward: - judgementsContainer.Clear(true); + handleSeek(); return false; } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index b27a9c5f5d..dff2dcc86b 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play private readonly SongProgressGraph graph; private readonly SongProgressInfo info; + public SongProgressBar Bar => bar; + public Action RequestSeek; /// From b2b3108afa84f7c156c00876ee75390f8933a2b2 Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Fri, 17 Sep 2021 16:19:41 -0400 Subject: [PATCH 03/12] Resolve addressed issues + Stopped using testing methods in non-testing classes + Resolve Player and add OnSeek event + Take bindings away from BarHitErrorMeter + Add support for ColourHitErrorMeter --- .idea/.idea.osu.Desktop/.idea/discord.xml | 7 +++++ .../HUD/HitErrorMeters/BarHitErrorMeter.cs | 31 ++----------------- .../HUD/HitErrorMeters/ColourHitErrorMeter.cs | 2 ++ .../Play/HUD/HitErrorMeters/HitErrorMeter.cs | 8 +++++ osu.Game/Screens/Play/Player.cs | 8 ++++- 5 files changed, 26 insertions(+), 30 deletions(-) create mode 100644 .idea/.idea.osu.Desktop/.idea/discord.xml diff --git a/.idea/.idea.osu.Desktop/.idea/discord.xml b/.idea/.idea.osu.Desktop/.idea/discord.xml new file mode 100644 index 0000000000..30bab2abb1 --- /dev/null +++ b/.idea/.idea.osu.Desktop/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 2854fabbae..2b5228cab0 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -10,10 +10,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Bindings; -using osu.Framework.Testing; using osu.Game.Graphics; -using osu.Game.Input.Bindings; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osuTK; @@ -21,7 +18,7 @@ using osuTK.Graphics; namespace osu.Game.Screens.Play.HUD.HitErrorMeters { - public class BarHitErrorMeter : HitErrorMeter, IKeyBindingHandler + public class BarHitErrorMeter : HitErrorMeter { private const int arrow_move_duration = 400; @@ -144,10 +141,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters arrow.Alpha = 0; arrow.Delay(200).FadeInFromZero(600); - - var progressBar = Parent.ChildrenOfType().FirstOrDefault(); - if (progressBar != null) - progressBar.Bar.OnSeek += _ => handleSeek(); } private void createColourBars(OsuColour colours) @@ -287,26 +280,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } - private void handleSeek() - { - judgementsContainer.Clear(true); - } - - public bool OnPressed(GlobalAction action) - { - switch (action) - { - case GlobalAction.SeekReplayBackward: - case GlobalAction.SeekReplayForward: - handleSeek(); - return false; - } - - return false; - } - - public void OnReleased(GlobalAction action) - { - } + public override void Clear() => judgementsContainer.Clear(true); } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index dda2a6da95..ea64d1f4d9 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -33,6 +33,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters judgementsFlow.Push(GetColourForHitResult(judgement.Type)); } + public override void Clear() => judgementsFlow.Clear(true); + private class JudgementFlow : FillFlowContainer { private const int max_available_judgements = 20; diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index 788ba5be8c..22ae3900d6 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -22,6 +22,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters [Resolved] private OsuColour colours { get; set; } + [Resolved(canBeNull: true)] + private Player player { get; set; } + public bool UsesFixedAnchor { get; set; } [BackgroundDependencyLoader(true)] @@ -34,6 +37,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters { base.LoadComplete(); + if (player != null) + player.OnSeek += Clear; + processor.NewJudgement += OnNewJudgement; } @@ -67,6 +73,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } + public abstract void Clear(); + protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e8a2790c94..f0544d5fcd 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -69,6 +69,8 @@ namespace osu.Game.Screens.Play public Action RestartRequested; + public Action OnSeek; + public bool HasFailed { get; private set; } private Bindable mouseWheelDisabled; @@ -584,7 +586,11 @@ namespace osu.Game.Screens.Play /// Seek to a specific time in gameplay. /// /// The destination time to seek to. - public void Seek(double time) => GameplayClockContainer.Seek(time); + public void Seek(double time) + { + GameplayClockContainer.Seek(time); + OnSeek.Invoke(); + } private ScheduledDelegate frameStablePlaybackResetDelegate; From 680484bb165361ef1b6ea81562266d190937268d Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Sat, 18 Sep 2021 12:04:25 -0400 Subject: [PATCH 04/12] Remove discord.xml Not sure how that slipped in there, but it's gone now! --- .idea/.idea.osu.Desktop/.idea/discord.xml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .idea/.idea.osu.Desktop/.idea/discord.xml diff --git a/.idea/.idea.osu.Desktop/.idea/discord.xml b/.idea/.idea.osu.Desktop/.idea/discord.xml deleted file mode 100644 index 30bab2abb1..0000000000 --- a/.idea/.idea.osu.Desktop/.idea/discord.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file From 12cc16c598f4bab59c0ab0e805ada327c4ca4c18 Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Sat, 18 Sep 2021 12:05:06 -0400 Subject: [PATCH 05/12] Remove unused property in `SongProgress` --- osu.Game/Screens/Play/SongProgress.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index dff2dcc86b..b27a9c5f5d 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -35,8 +35,6 @@ namespace osu.Game.Screens.Play private readonly SongProgressGraph graph; private readonly SongProgressInfo info; - public SongProgressBar Bar => bar; - public Action RequestSeek; /// From f6e279baa1764a876884341a66f3af6ab05afd5d Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Sat, 18 Sep 2021 12:18:11 -0400 Subject: [PATCH 06/12] Add xmldoc to HitErrorMeter.Clear Explains how the method is called and what inheritors should do when implementing it. --- osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index 22ae3900d6..1871519ab5 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -73,6 +73,10 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } + /// + /// Invoked by when the active seeks through the current beatmap. + /// Any inheritors of should have this method clear their container that displays the hit error results. + /// public abstract void Clear(); protected override void Dispose(bool isDisposing) From 04715a54719766a519287f1bf58538f3d0414d0c Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Sat, 18 Sep 2021 12:20:36 -0400 Subject: [PATCH 07/12] Add null-check when invoking OnSeek --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f0544d5fcd..e982d02baf 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -589,7 +589,7 @@ namespace osu.Game.Screens.Play public void Seek(double time) { GameplayClockContainer.Seek(time); - OnSeek.Invoke(); + OnSeek?.Invoke(); } private ScheduledDelegate frameStablePlaybackResetDelegate; From 93ca615c022f4d00a972d97ae947426447b14333 Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Sun, 19 Sep 2021 14:15:22 -0400 Subject: [PATCH 08/12] Add tests for clearing `HitErrorMeter` Works with both `BarHitErrorMeter` and `ColourHitErrorMeter` --- .../Visual/Gameplay/TestSceneHitErrorMeter.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index 7accaef818..1ba0965ceb 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -7,6 +7,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; @@ -137,6 +138,23 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("no circle added", () => !this.ChildrenOfType().Any()); } + [Test] + public void TestClear() + { + AddStep("OD 1", () => recreateDisplay(new OsuHitWindows(), 1)); + + AddStep("hit", () => newJudgement(0.2D)); + AddAssert("bar added", () => this.ChildrenOfType().All( + meter => meter.ChildrenOfType().Count() == 1)); + AddAssert("circle added", () => this.ChildrenOfType().All( + meter => meter.ChildrenOfType().Count() == 1)); + + AddStep("clear", () => this.ChildrenOfType().ForEach(meter => meter.Clear())); + + AddAssert("bar cleared", () => !this.ChildrenOfType().Any()); + AddAssert("colour cleared", () => !this.ChildrenOfType().Any()); + } + private void recreateDisplay(HitWindows hitWindows, float overallDifficulty) { hitWindows?.SetDifficulty(overallDifficulty); From 10fe2382b08abf113d0ca020f11307284041cb9e Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Mon, 20 Sep 2021 10:07:42 -0400 Subject: [PATCH 09/12] Address most issues --- osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs | 2 +- .../Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs | 2 +- osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs | 5 ++++- osu.Game/Screens/Play/Player.cs | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 2b5228cab0..604df0b774 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -280,6 +280,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } - public override void Clear() => judgementsContainer.Clear(true); + protected override void Clear() => judgementsContainer.Clear(); } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index ea64d1f4d9..19ba1910e6 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters judgementsFlow.Push(GetColourForHitResult(judgement.Type)); } - public override void Clear() => judgementsFlow.Clear(true); + protected override void Clear() => judgementsFlow.Clear(); private class JudgementFlow : FillFlowContainer { diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index 1871519ab5..f9d4d89d1b 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters /// Invoked by when the active seeks through the current beatmap. /// Any inheritors of should have this method clear their container that displays the hit error results. /// - public abstract void Clear(); + protected abstract void Clear(); protected override void Dispose(bool isDisposing) { @@ -85,6 +85,9 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters if (processor != null) processor.NewJudgement -= OnNewJudgement; + + if (player != null) + player.OnSeek -= Clear; } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e982d02baf..cde3cda369 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -69,7 +69,10 @@ namespace osu.Game.Screens.Play public Action RestartRequested; - public Action OnSeek; + /// + /// Invoked when a seek has been performed via + /// + public event Action OnSeek; public bool HasFailed { get; private set; } From 36a20ab0b365d77878a76c0fbf4444bd6b67380f Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Mon, 20 Sep 2021 10:22:36 -0400 Subject: [PATCH 10/12] Resolve failed test compilation --- osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs | 2 +- .../Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs | 2 +- osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs index 604df0b774..39dafaffad 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/BarHitErrorMeter.cs @@ -280,6 +280,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } } - protected override void Clear() => judgementsContainer.Clear(); + public override void Clear() => judgementsContainer.Clear(); } } diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs index 19ba1910e6..5012be7249 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/ColourHitErrorMeter.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters judgementsFlow.Push(GetColourForHitResult(judgement.Type)); } - protected override void Clear() => judgementsFlow.Clear(); + public override void Clear() => judgementsFlow.Clear(); private class JudgementFlow : FillFlowContainer { diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index f9d4d89d1b..a864753b0c 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// 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; @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters /// Invoked by when the active seeks through the current beatmap. /// Any inheritors of should have this method clear their container that displays the hit error results. /// - protected abstract void Clear(); + public abstract void Clear(); protected override void Dispose(bool isDisposing) { From 9a1db04920ea9034980d70bd9f0d26ad45862ca2 Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Mon, 20 Sep 2021 10:28:58 -0400 Subject: [PATCH 11/12] Resolve `GameplayClockContainer` instead of `Player` --- osu.Game/Screens/Play/GameplayClockContainer.cs | 8 ++++++++ .../Play/HUD/HitErrorMeters/HitErrorMeter.cs | 14 +++++++------- osu.Game/Screens/Play/Player.cs | 6 ------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index f791da80c8..0c9b827a41 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -13,6 +13,7 @@ namespace osu.Game.Screens.Play /// /// Encapsulates gameplay timing logic and provides a via DI for gameplay components to use. /// + [Cached] public abstract class GameplayClockContainer : Container, IAdjustableClock { /// @@ -35,6 +36,11 @@ namespace osu.Game.Screens.Play /// protected IClock SourceClock { get; private set; } + /// + /// Invoked when a seek has been performed via + /// + public event Action OnSeek; + /// /// Creates a new . /// @@ -88,6 +94,8 @@ namespace osu.Game.Screens.Play // Manually process to make sure the gameplay clock is correctly updated after a seek. GameplayClock.UnderlyingClock.ProcessFrame(); + + OnSeek?.Invoke(); } /// diff --git a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs index a864753b0c..c7b06a3a2c 100644 --- a/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs +++ b/osu.Game/Screens/Play/HUD/HitErrorMeters/HitErrorMeter.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// 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; @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters private OsuColour colours { get; set; } [Resolved(canBeNull: true)] - private Player player { get; set; } + private GameplayClockContainer gameplayClockContainer { get; set; } public bool UsesFixedAnchor { get; set; } @@ -37,8 +37,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters { base.LoadComplete(); - if (player != null) - player.OnSeek += Clear; + if (gameplayClockContainer != null) + gameplayClockContainer.OnSeek += Clear; processor.NewJudgement += OnNewJudgement; } @@ -74,7 +74,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters } /// - /// Invoked by when the active seeks through the current beatmap. + /// Invoked by . /// Any inheritors of should have this method clear their container that displays the hit error results. /// public abstract void Clear(); @@ -86,8 +86,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters if (processor != null) processor.NewJudgement -= OnNewJudgement; - if (player != null) - player.OnSeek -= Clear; + if (gameplayClockContainer != null) + gameplayClockContainer.OnSeek -= Clear; } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cde3cda369..a9a74d30d4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -69,11 +69,6 @@ namespace osu.Game.Screens.Play public Action RestartRequested; - /// - /// Invoked when a seek has been performed via - /// - public event Action OnSeek; - public bool HasFailed { get; private set; } private Bindable mouseWheelDisabled; @@ -592,7 +587,6 @@ namespace osu.Game.Screens.Play public void Seek(double time) { GameplayClockContainer.Seek(time); - OnSeek?.Invoke(); } private ScheduledDelegate frameStablePlaybackResetDelegate; From fb416c79e906c7fd95c031f3f6de00778ac36f7f Mon Sep 17 00:00:00 2001 From: sh0ckR6 Date: Mon, 20 Sep 2021 15:01:03 -0400 Subject: [PATCH 12/12] Fully revert `Player` --- osu.Game/Screens/Play/Player.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a9a74d30d4..e8a2790c94 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -584,10 +584,7 @@ namespace osu.Game.Screens.Play /// Seek to a specific time in gameplay. /// /// The destination time to seek to. - public void Seek(double time) - { - GameplayClockContainer.Seek(time); - } + public void Seek(double time) => GameplayClockContainer.Seek(time); private ScheduledDelegate frameStablePlaybackResetDelegate;