1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-11 19:42:55 +08:00

Remove unnecessary setClock shenanigans

This commit is contained in:
Dean Herbert 2022-08-15 19:01:28 +09:00
parent 27569e2ed5
commit 828b6f2c30

View File

@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.UI
protected override void LoadComplete()
{
base.LoadComplete();
setClock();
Clock = this;
}
private PlaybackState state;
@ -128,12 +128,7 @@ namespace osu.Game.Rulesets.UI
state = PlaybackState.Valid;
}
if (parentGameplayClock == null)
setClock(); // LoadComplete may not be run yet, but we still want the clock.
Debug.Assert(parentGameplayClock != null);
double proposedTime = parentGameplayClock.CurrentTime;
double proposedTime = Clock.CurrentTime;
if (FrameStablePlayback)
// if we require frame stability, the proposed time will be adjusted to move at most one known
@ -153,14 +148,14 @@ namespace osu.Game.Rulesets.UI
if (state == PlaybackState.Valid && proposedTime != manualClock.CurrentTime)
direction = proposedTime >= manualClock.CurrentTime ? 1 : -1;
double timeBehind = Math.Abs(proposedTime - parentGameplayClock.CurrentTime);
double timeBehind = Math.Abs(proposedTime - Clock.CurrentTime);
IsCatchingUp.Value = timeBehind > 200;
WaitingOnFrames.Value = state == PlaybackState.NotValid;
manualClock.CurrentTime = proposedTime;
manualClock.Rate = Math.Abs(parentGameplayClock.Rate) * direction;
manualClock.IsRunning = parentGameplayClock.IsRunning;
manualClock.Rate = Math.Abs(Clock.Rate) * direction;
manualClock.IsRunning = Clock.IsRunning;
// determine whether catch-up is required.
if (state == PlaybackState.Valid && timeBehind > 0)
@ -239,12 +234,6 @@ namespace osu.Game.Rulesets.UI
}
}
private void setClock()
{
if (parentGameplayClock != null)
Clock = this;
}
public ReplayInputHandler? ReplayInputHandler { get; set; }
#region Delegation of IFrameStableClock