mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:13:34 +08:00
Expose rewinding state of IGameplayClock
s
The implementation of this requires a bit of a special case for 0, so makes sense to implement in a central place.
This commit is contained in:
parent
7a3a14e50d
commit
2e98ab0a48
@ -125,6 +125,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
public IEnumerable<double> NonGameplayAdjustments => throw new NotImplementedException();
|
||||
public IBindable<bool> IsPaused => throw new NotImplementedException();
|
||||
public bool IsRewinding => false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ namespace osu.Game.Beatmaps
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> 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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -247,6 +250,8 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
public IBindable<bool> IsPaused { get; } = new BindableBool();
|
||||
|
||||
public bool IsRewinding { get; private set; }
|
||||
|
||||
public double CurrentTime => framedClock.CurrentTime;
|
||||
|
||||
public double Rate => framedClock.Rate;
|
||||
|
@ -19,11 +19,10 @@ namespace osu.Game.Screens.Play
|
||||
[Cached(typeof(IGameplayClock))]
|
||||
public partial class GameplayClockContainer : Container, IAdjustableClock, IGameplayClock
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether gameplay is paused.
|
||||
/// </summary>
|
||||
public IBindable<bool> IsPaused => isPaused;
|
||||
|
||||
public bool IsRewinding => GameplayClock.IsRewinding;
|
||||
|
||||
/// <summary>
|
||||
/// The source clock. Should generally not be used for any timekeeping purposes.
|
||||
/// </summary>
|
||||
|
@ -23,6 +23,14 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
IAdjustableAudioComponent AdjustmentsFromMods { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether gameplay is paused.
|
||||
/// </summary>
|
||||
IBindable<bool> IsPaused { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the clock is currently rewinding.
|
||||
/// </summary>
|
||||
bool IsRewinding { get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user