1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

Avoid running full updateClock loop when waiting on frames

This commit is contained in:
Dean Herbert 2020-10-30 12:39:11 +09:00
parent 87be7d162b
commit 8e6c803900

View File

@ -85,30 +85,29 @@ namespace osu.Game.Rulesets.UI
public override bool UpdateSubTree() public override bool UpdateSubTree()
{ {
double aimTime = manualClock.CurrentTime; if (parentGameplayClock == null)
setClock(); // LoadComplete may not be run yet, but we still want the clock.
double aimTime = parentGameplayClock.CurrentTime;
if (frameStableClock.WaitingOnFrames.Value) if (frameStableClock.WaitingOnFrames.Value)
{ {
// when waiting on frames, the update loop still needs to be run (at least once) to check for newly arrived frames. // waiting on frames is a special case where we want to avoid doing any update propagation, unless new frame data has arrived.
// time should not be sourced from the parent clock in this case. state = ReplayInputHandler.SetFrameFromTime(aimTime) != null ? PlaybackState.Valid : PlaybackState.NotValid;
state = PlaybackState.Valid;
} }
else if (!frameStableClock.IsPaused.Value) else if (!frameStableClock.IsPaused.Value)
{ {
state = PlaybackState.Valid; state = PlaybackState.Valid;
if (parentGameplayClock == null)
setClock(); // LoadComplete may not be run yet, but we still want the clock.
aimTime = parentGameplayClock.CurrentTime;
} }
else else
{ {
// time should not advance while paused, not should anything run. // time should not advance while paused, nor should anything run.
state = PlaybackState.NotValid; state = PlaybackState.NotValid;
return true;
} }
if (state == PlaybackState.NotValid)
return true;
int loops = MaxCatchUpFrames; int loops = MaxCatchUpFrames;
while (loops-- > 0) while (loops-- > 0)