mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 11:42:55 +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
5af4aa8741
commit
af3f9086e5
@ -125,6 +125,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public IEnumerable<double> NonGameplayAdjustments => throw new NotImplementedException();
|
public IEnumerable<double> NonGameplayAdjustments => throw new NotImplementedException();
|
||||||
public IBindable<bool> IsPaused => throw new NotImplementedException();
|
public IBindable<bool> IsPaused => throw new NotImplementedException();
|
||||||
|
public bool IsRewinding => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,8 @@ namespace osu.Game.Beatmaps
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
|
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
|
||||||
|
|
||||||
|
public bool IsRewinding { get; private set; }
|
||||||
|
|
||||||
public bool IsCoupled
|
public bool IsCoupled
|
||||||
{
|
{
|
||||||
get => decoupledClock.IsCoupled;
|
get => decoupledClock.IsCoupled;
|
||||||
@ -133,6 +135,9 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
finalClockSource.ProcessFrame();
|
finalClockSource.ProcessFrame();
|
||||||
|
|
||||||
|
if (Clock.ElapsedFrameTime != 0)
|
||||||
|
IsRewinding = Clock.ElapsedFrameTime < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double TotalAppliedOffset
|
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
|
// 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
|
// to ensure that the its time is valid for our children before input is processed
|
||||||
framedClock.ProcessFrame();
|
framedClock.ProcessFrame();
|
||||||
|
|
||||||
|
if (framedClock.ElapsedFrameTime != 0)
|
||||||
|
IsRewinding = framedClock.ElapsedFrameTime < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -247,6 +250,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public IBindable<bool> IsPaused { get; } = new BindableBool();
|
public IBindable<bool> IsPaused { get; } = new BindableBool();
|
||||||
|
|
||||||
|
public bool IsRewinding { get; private set; }
|
||||||
|
|
||||||
public double CurrentTime => framedClock.CurrentTime;
|
public double CurrentTime => framedClock.CurrentTime;
|
||||||
|
|
||||||
public double Rate => framedClock.Rate;
|
public double Rate => framedClock.Rate;
|
||||||
|
@ -19,11 +19,10 @@ namespace osu.Game.Screens.Play
|
|||||||
[Cached(typeof(IGameplayClock))]
|
[Cached(typeof(IGameplayClock))]
|
||||||
public partial class GameplayClockContainer : Container, IAdjustableClock, IGameplayClock
|
public partial class GameplayClockContainer : Container, IAdjustableClock, IGameplayClock
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Whether gameplay is paused.
|
|
||||||
/// </summary>
|
|
||||||
public IBindable<bool> IsPaused => isPaused;
|
public IBindable<bool> IsPaused => isPaused;
|
||||||
|
|
||||||
|
public bool IsRewinding => GameplayClock.IsRewinding;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The source clock. Should generally not be used for any timekeeping purposes.
|
/// The source clock. Should generally not be used for any timekeeping purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -23,6 +23,14 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IAdjustableAudioComponent AdjustmentsFromMods { get; }
|
IAdjustableAudioComponent AdjustmentsFromMods { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether gameplay is paused.
|
||||||
|
/// </summary>
|
||||||
IBindable<bool> IsPaused { get; }
|
IBindable<bool> IsPaused { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the clock is currently rewinding.
|
||||||
|
/// </summary>
|
||||||
|
bool IsRewinding { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user