1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Move clock processing to base.Seek()

This commit is contained in:
smoogipoo 2021-04-20 17:35:59 +09:00
parent 5da18c51a4
commit 97fb90d9f4
2 changed files with 7 additions and 6 deletions

View File

@ -87,7 +87,13 @@ namespace osu.Game.Screens.Play
/// Seek to a specific time in gameplay.
/// </summary>
/// <param name="time">The destination time to seek to.</param>
public virtual void Seek(double time) => AdjustableSource.Seek(time);
public virtual void Seek(double time)
{
AdjustableSource.Seek(time);
// Manually process to make sure the gameplay clock is correctly updated after a seek.
GameplayClock.UnderlyingClock.ProcessFrame();
}
/// <summary>
/// Stops gameplay.
@ -102,8 +108,6 @@ namespace osu.Game.Screens.Play
AdjustableSource.Seek(StartOffset);
AdjustableSource.Stop();
// Make sure the gameplay clock takes on the new time, otherwise the adjustable source will be seeked to the gameplay clock time in Start().
GameplayClock.UnderlyingClock.ProcessFrame();
if (!IsPaused.Value)
Start();

View File

@ -123,9 +123,6 @@ namespace osu.Game.Screens.Play
// remove the offset component here because most of the time we want the seek to be aligned to gameplay, not the audio track.
// we may want to consider reversing the application of offsets in the future as it may feel more correct.
base.Seek(time - totalOffset);
// manually process frame to ensure GameplayClock is correctly updated after a seek.
userOffsetClock.ProcessFrame();
}
/// <summary>