mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Ensure online play subscreen is loaded before forwarding OnExiting
Closes https://github.com/ppy/osu-framework/issues/4619 (actually not a
framework issue; the framework correctly guards against this scenario,
see
4e29504384/osu.Framework/Screens/ScreenStack.cs (L277)
).
Added the assertions to be very explicit about the nested stack's state
at this point. Both of those events can only be triggered if the stack
has a loaded screen (as far as I can tell), making this check
unnecessary in those cases.
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -222,7 +223,9 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
this.FadeIn(250);
|
this.FadeIn(250);
|
||||||
this.ScaleTo(1, 250, Easing.OutSine);
|
this.ScaleTo(1, 250, Easing.OutSine);
|
||||||
|
|
||||||
screenStack.CurrentScreen?.OnResuming(last);
|
Debug.Assert(screenStack.CurrentScreen != null);
|
||||||
|
screenStack.CurrentScreen.OnResuming(last);
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
UpdatePollingRate(isIdle.Value);
|
UpdatePollingRate(isIdle.Value);
|
||||||
@ -233,14 +236,16 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
this.ScaleTo(1.1f, 250, Easing.InSine);
|
this.ScaleTo(1.1f, 250, Easing.InSine);
|
||||||
this.FadeOut(250);
|
this.FadeOut(250);
|
||||||
|
|
||||||
screenStack.CurrentScreen?.OnSuspending(next);
|
Debug.Assert(screenStack.CurrentScreen != null);
|
||||||
|
screenStack.CurrentScreen.OnSuspending(next);
|
||||||
|
|
||||||
UpdatePollingRate(isIdle.Value);
|
UpdatePollingRate(isIdle.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
if (screenStack.CurrentScreen?.OnExiting(next) == true)
|
var subScreen = screenStack.CurrentScreen as Drawable;
|
||||||
|
if (subScreen?.IsLoaded == true && screenStack.CurrentScreen.OnExiting(next))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
RoomManager.PartRoom();
|
RoomManager.PartRoom();
|
||||||
|
Reference in New Issue
Block a user