Use a more explicit flow to set and reset GameplayClockContainer start time

This commit is contained in:
Dean Herbert
2022-03-17 20:54:42 +09:00
parent e3a8bb2d1c
commit a4a0241800
4 changed files with 48 additions and 33 deletions

View File

@ -607,13 +607,13 @@ namespace osu.Game.Screens.Play
private ScheduledDelegate frameStablePlaybackResetDelegate;
/// <summary>
/// Seeks to a specific time in gameplay, bypassing frame stability.
/// Specify and seek to a custom start time from which gameplay should be observed.
/// </summary>
/// <remarks>
/// Intermediate hitobject judgements may not be applied or reverted correctly during this seek.
/// This performance a non-frame-stable seek. Intermediate hitobject judgements may not be applied or reverted correctly during this seek.
/// </remarks>
/// <param name="time">The destination time to seek to.</param>
internal void NonFrameStableSeek(double time)
protected void SetGameplayStartTime(double time)
{
if (frameStablePlaybackResetDelegate?.Cancelled == false && !frameStablePlaybackResetDelegate.Completed)
frameStablePlaybackResetDelegate.RunTask();
@ -621,7 +621,7 @@ namespace osu.Game.Screens.Play
bool wasFrameStable = DrawableRuleset.FrameStablePlayback;
DrawableRuleset.FrameStablePlayback = false;
Seek(time);
GameplayClockContainer.Reset(gameplayStartTime: time);
// Delay resetting frame-stable playback for one frame to give the FrameStabilityContainer a chance to seek.
frameStablePlaybackResetDelegate = ScheduleAfterChildren(() => DrawableRuleset.FrameStablePlayback = wasFrameStable);
@ -981,7 +981,7 @@ namespace osu.Game.Screens.Play
if (GameplayClockContainer.GameplayClock.IsRunning)
throw new InvalidOperationException($"{nameof(StartGameplay)} should not be called when the gameplay clock is already running");
GameplayClockContainer.Reset();
GameplayClockContainer.Reset(true);
}
public override void OnSuspending(IScreen next)