mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Fix MasterGameplayClockContainer
having incorrect rate-based offsets immediately after LoadComplete
I've attempted to explain why this is required using inline comments. There's also further conversation at https://github.com/ppy/osu/pull/17302#issuecomment-1091850927.
This commit is contained in:
@ -130,7 +130,9 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override void OnIsPausedChanged(ValueChangedEvent<bool> isPaused)
|
protected override void OnIsPausedChanged(ValueChangedEvent<bool> isPaused)
|
||||||
{
|
{
|
||||||
// The source is stopped by a frequency fade first.
|
if (IsLoaded)
|
||||||
|
{
|
||||||
|
// During normal operation, the source is stopped after performing a frequency ramp.
|
||||||
if (isPaused.NewValue)
|
if (isPaused.NewValue)
|
||||||
{
|
{
|
||||||
this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ =>
|
this.TransformBindableTo(pauseFreqAdjust, 0, 200, Easing.Out).OnComplete(_ =>
|
||||||
@ -142,6 +144,19 @@ namespace osu.Game.Screens.Play
|
|||||||
else
|
else
|
||||||
this.TransformBindableTo(pauseFreqAdjust, 1, 200, Easing.In);
|
this.TransformBindableTo(pauseFreqAdjust, 1, 200, Easing.In);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (isPaused.NewValue)
|
||||||
|
AdjustableSource.Stop();
|
||||||
|
|
||||||
|
// If not yet loaded, we still want to ensure relevant state is correct, as it is used for offset calculations.
|
||||||
|
pauseFreqAdjust.Value = isPaused.NewValue ? 0 : 1;
|
||||||
|
|
||||||
|
// We must also process underlying gameplay clocks to update rate-adjusted offsets with the new frequency adjustment.
|
||||||
|
// Without doing this, an initial seek may be performed with the wrong offset.
|
||||||
|
GameplayClock.UnderlyingClock.ProcessFrame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Start()
|
public override void Start()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user