mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Fix Reset() potentially not resetting to the intended start position
This commit is contained in:
@ -29,6 +29,11 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
protected readonly DecoupleableInterpolatingFramedClock AdjustableSource;
|
||||
|
||||
/// <summary>
|
||||
/// The offset at which to start playing. Affects the time which the clock is reset to via <see cref="Reset"/>.
|
||||
/// </summary>
|
||||
protected virtual double StartOffset => 0;
|
||||
|
||||
/// <summary>
|
||||
/// The source clock.
|
||||
/// </summary>
|
||||
@ -93,9 +98,12 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
ChangeSource(SourceClock);
|
||||
|
||||
AdjustableSource.Seek(0);
|
||||
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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user