mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:02:55 +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()
|
private void pushWhenLoaded()
|
||||||
{
|
{
|
||||||
Schedule(pushWhenLoaded);
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (!readyForPush)
|
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?.Cancel();
|
||||||
pushDebounce = null;
|
pushDebounce = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pushDebounce == null)
|
if (pushDebounce != null)
|
||||||
|
return;
|
||||||
|
|
||||||
pushDebounce = Scheduler.AddDelayed(() =>
|
pushDebounce = Scheduler.AddDelayed(() =>
|
||||||
{
|
{
|
||||||
contentOut();
|
contentOut();
|
||||||
@ -160,6 +166,11 @@ namespace osu.Game.Screens.Play
|
|||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Schedule(pushWhenLoaded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
protected override bool OnExiting(Screen next)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user