mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Merge pull request #11139 from peppy/fix-single-threaded-seeking
This commit is contained in:
commit
3ffa03a2c5
@ -95,6 +95,16 @@ namespace osu.Game.Screens.Play
|
||||
localGameplayClock = new LocalGameplayClock(userOffsetClock);
|
||||
|
||||
GameplayClock.IsPaused.BindTo(IsPaused);
|
||||
|
||||
IsPaused.BindValueChanged(onPauseChanged);
|
||||
}
|
||||
|
||||
private void onPauseChanged(ValueChangedEvent<bool> isPaused)
|
||||
{
|
||||
if (isPaused.NewValue)
|
||||
this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ => adjustableClock.Stop());
|
||||
else
|
||||
this.TransformBindableTo(pauseFreqAdjust, 1, 200, Easing.In);
|
||||
}
|
||||
|
||||
private double totalOffset => userOffsetClock.Offset + platformOffsetClock.Offset;
|
||||
@ -154,13 +164,16 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// Seeking the decoupled clock to its current time ensures that its source clock will be seeked to the same time
|
||||
// This accounts for the audio clock source potentially taking time to enter a completely stopped state
|
||||
Seek(GameplayClock.CurrentTime);
|
||||
adjustableClock.Start();
|
||||
IsPaused.Value = false;
|
||||
if (!adjustableClock.IsRunning)
|
||||
{
|
||||
// Seeking the decoupled clock to its current time ensures that its source clock will be seeked to the same time
|
||||
// This accounts for the audio clock source potentially taking time to enter a completely stopped state
|
||||
Seek(GameplayClock.CurrentTime);
|
||||
|
||||
this.TransformBindableTo(pauseFreqAdjust, 1, 200, Easing.In);
|
||||
adjustableClock.Start();
|
||||
}
|
||||
|
||||
IsPaused.Value = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -199,8 +212,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ => adjustableClock.Stop());
|
||||
|
||||
IsPaused.Value = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user