diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneClicksPerSecondCalculator.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneClicksPerSecondCalculator.cs index bcb5291108..db06329d74 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneClicksPerSecondCalculator.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneClicksPerSecondCalculator.cs @@ -125,6 +125,7 @@ namespace osu.Game.Tests.Visual.Gameplay public IEnumerable NonGameplayAdjustments => throw new NotImplementedException(); public IBindable IsPaused => throw new NotImplementedException(); + public bool IsRewinding => false; } } } diff --git a/osu.Game/Beatmaps/FramedBeatmapClock.cs b/osu.Game/Beatmaps/FramedBeatmapClock.cs index 080b0ce7ec..399e2fde7f 100644 --- a/osu.Game/Beatmaps/FramedBeatmapClock.cs +++ b/osu.Game/Beatmaps/FramedBeatmapClock.cs @@ -64,6 +64,8 @@ namespace osu.Game.Beatmaps [Resolved] private IBindable beatmap { get; set; } = null!; + public bool IsRewinding { get; private set; } + public bool IsCoupled { get => decoupledClock.IsCoupled; @@ -133,6 +135,9 @@ namespace osu.Game.Beatmaps } else finalClockSource.ProcessFrame(); + + if (Clock.ElapsedFrameTime != 0) + IsRewinding = Clock.ElapsedFrameTime < 0; } public double TotalAppliedOffset diff --git a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs index 4bb145973d..90cffab714 100644 --- a/osu.Game/Rulesets/UI/FrameStabilityContainer.cs +++ b/osu.Game/Rulesets/UI/FrameStabilityContainer.cs @@ -171,6 +171,9 @@ namespace osu.Game.Rulesets.UI // The manual clock time has changed in the above code. The framed clock now needs to be updated // to ensure that the its time is valid for our children before input is processed framedClock.ProcessFrame(); + + if (framedClock.ElapsedFrameTime != 0) + IsRewinding = framedClock.ElapsedFrameTime < 0; } /// @@ -247,6 +250,8 @@ namespace osu.Game.Rulesets.UI public IBindable IsPaused { get; } = new BindableBool(); + public bool IsRewinding { get; private set; } + public double CurrentTime => framedClock.CurrentTime; public double Rate => framedClock.Rate; diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index c42f607908..22e6884526 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -19,11 +19,10 @@ namespace osu.Game.Screens.Play [Cached(typeof(IGameplayClock))] public partial class GameplayClockContainer : Container, IAdjustableClock, IGameplayClock { - /// - /// Whether gameplay is paused. - /// public IBindable IsPaused => isPaused; + public bool IsRewinding => GameplayClock.IsRewinding; + /// /// The source clock. Should generally not be used for any timekeeping purposes. /// diff --git a/osu.Game/Screens/Play/IGameplayClock.cs b/osu.Game/Screens/Play/IGameplayClock.cs index 83ba5f3474..ad28e343ff 100644 --- a/osu.Game/Screens/Play/IGameplayClock.cs +++ b/osu.Game/Screens/Play/IGameplayClock.cs @@ -23,6 +23,14 @@ namespace osu.Game.Screens.Play /// IAdjustableAudioComponent AdjustmentsFromMods { get; } + /// + /// Whether gameplay is paused. + /// IBindable IsPaused { get; } + + /// + /// Whether the clock is currently rewinding. + /// + bool IsRewinding { get; } } }