Remove ClockToProcess, always process underlying clock

This commit is contained in:
smoogipoo 2021-04-16 20:15:42 +09:00
parent 5e82f40d67
commit f98ffbb1b3
2 changed files with 10 additions and 12 deletions

View File

@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play
/// </summary>
public class GameplayClock : IFrameBasedClock
{
private readonly IFrameBasedClock underlyingClock;
internal readonly IFrameBasedClock UnderlyingClock;
public readonly BindableBool IsPaused = new BindableBool();
@ -30,12 +30,12 @@ namespace osu.Game.Screens.Play
public GameplayClock(IFrameBasedClock underlyingClock)
{
this.underlyingClock = underlyingClock;
UnderlyingClock = underlyingClock;
}
public double CurrentTime => underlyingClock.CurrentTime;
public double CurrentTime => UnderlyingClock.CurrentTime;
public double Rate => underlyingClock.Rate;
public double Rate => UnderlyingClock.Rate;
/// <summary>
/// The rate of gameplay when playback is at 100%.
@ -59,19 +59,19 @@ namespace osu.Game.Screens.Play
}
}
public bool IsRunning => underlyingClock.IsRunning;
public bool IsRunning => UnderlyingClock.IsRunning;
public void ProcessFrame()
{
// intentionally not updating the underlying clock (handled externally).
}
public double ElapsedFrameTime => underlyingClock.ElapsedFrameTime;
public double ElapsedFrameTime => UnderlyingClock.ElapsedFrameTime;
public double FramesPerSecond => underlyingClock.FramesPerSecond;
public double FramesPerSecond => UnderlyingClock.FramesPerSecond;
public FrameTimeInfo TimeInfo => underlyingClock.TimeInfo;
public FrameTimeInfo TimeInfo => UnderlyingClock.TimeInfo;
public IClock Source => underlyingClock;
public IClock Source => UnderlyingClock;
}
}

View File

@ -80,15 +80,13 @@ namespace osu.Game.Screens.Play
protected override void Update()
{
if (!IsPaused.Value)
ClockToProcess.ProcessFrame();
GameplayClock.UnderlyingClock.ProcessFrame();
base.Update();
}
protected abstract void OnIsPausedChanged(ValueChangedEvent<bool> isPaused);
protected virtual IFrameBasedClock ClockToProcess => AdjustableClock;
protected abstract GameplayClock CreateGameplayClock(IFrameBasedClock source);
}
}