mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:52:54 +08:00
Avoid scheduling during non-current screen
This commit is contained in:
parent
ef8d595914
commit
ea649f9650
@ -131,16 +131,22 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private void pushWhenLoaded()
|
||||
{
|
||||
Schedule(pushWhenLoaded);
|
||||
if (!IsCurrentScreen) return;
|
||||
|
||||
if (!readyForPush)
|
||||
try
|
||||
{
|
||||
pushDebounce?.Cancel();
|
||||
pushDebounce = null;
|
||||
return;
|
||||
}
|
||||
if (!readyForPush)
|
||||
{
|
||||
// as the pushDebounce below has a delay, we need to keep checking and cancel a future debounce
|
||||
// if we become unready for push during the delay.
|
||||
pushDebounce?.Cancel();
|
||||
pushDebounce = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pushDebounce != null)
|
||||
return;
|
||||
|
||||
if (pushDebounce == null)
|
||||
pushDebounce = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
contentOut();
|
||||
@ -159,6 +165,11 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Schedule(pushWhenLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnExiting(Screen next)
|
||||
|
Loading…
Reference in New Issue
Block a user