1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 19:32:55 +08:00

Merge branch 'frame-stability-clean-up' into spectator-replay-watcher

This commit is contained in:
Dean Herbert 2020-10-28 15:34:30 +09:00
commit 09da75b143

View File

@ -127,7 +127,12 @@ namespace osu.Game.Rulesets.UI
applyFrameStability(ref proposedTime); applyFrameStability(ref proposedTime);
if (hasReplayAttached) if (hasReplayAttached)
state = updateReplay(ref proposedTime); {
bool valid = updateReplay(ref proposedTime);
if (!valid)
state = PlaybackState.NotValid;
}
if (proposedTime != manualClock.CurrentTime) if (proposedTime != manualClock.CurrentTime)
direction = proposedTime >= manualClock.CurrentTime ? 1 : -1; direction = proposedTime >= manualClock.CurrentTime ? 1 : -1;
@ -139,8 +144,8 @@ namespace osu.Game.Rulesets.UI
double timeBehind = Math.Abs(manualClock.CurrentTime - parentGameplayClock.CurrentTime); double timeBehind = Math.Abs(manualClock.CurrentTime - parentGameplayClock.CurrentTime);
// determine whether catch-up is required. // determine whether catch-up is required.
if (state != PlaybackState.NotValid) if (state == PlaybackState.Valid && timeBehind > 0)
state = timeBehind > 0 ? PlaybackState.RequiresCatchUp : PlaybackState.Valid; state = PlaybackState.RequiresCatchUp;
frameStableClock.IsCatchingUp.Value = timeBehind > 200; frameStableClock.IsCatchingUp.Value = timeBehind > 200;
frameStableClock.WaitingOnFrames.Value = state == PlaybackState.NotValid; frameStableClock.WaitingOnFrames.Value = state == PlaybackState.NotValid;
@ -154,7 +159,8 @@ namespace osu.Game.Rulesets.UI
/// Attempt to advance replay playback for a given time. /// Attempt to advance replay playback for a given time.
/// </summary> /// </summary>
/// <param name="proposedTime">The time which is to be displayed.</param> /// <param name="proposedTime">The time which is to be displayed.</param>
private PlaybackState updateReplay(ref double proposedTime) /// <returns>Whether playback is still valid.</returns>
private bool updateReplay(ref double proposedTime)
{ {
double? newTime; double? newTime;
@ -180,10 +186,10 @@ namespace osu.Game.Rulesets.UI
} }
if (newTime == null) if (newTime == null)
return PlaybackState.NotValid; return false;
proposedTime = newTime.Value; proposedTime = newTime.Value;
return PlaybackState.Valid; return true;
} }
/// <summary> /// <summary>