From 56abe54fe6331f88c014baf7e34128bc070e8cec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Jun 2022 22:59:19 +0900 Subject: [PATCH] Redirect graceful exiting to standard exit flow Rather than doing a completely forced exit as we were, this will now follow a more standard flow with the ability for the user to abort along the way. This is more in line with how I wanted this to work. Note that this means a confirmation is now shown. It has been discussed in the past that this confirmation should only show when there's an ongoing action implies the user may want to cancel the exit. For now I think this is fine. Addresses https://github.com/ppy/osu/discussions/18399#discussioncomment-2811311 --- osu.Game/OsuGame.cs | 6 ++++++ osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3041761a6b..06ade5a3c9 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -637,6 +637,12 @@ namespace osu.Game Add(performFromMainMenuTask = new PerformFromMenuRunner(action, validScreens, () => ScreenStack.CurrentScreen)); } + public override void GracefullyExit() + { + // Using PerformFromScreen gives the user a chance to interrupt the exit process if needed. + PerformFromScreen(menu => menu.Exit()); + } + /// /// Wait for the game (and target component) to become loaded and then run an action. /// diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9908697bf1..dc7513d3c8 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -419,7 +419,7 @@ namespace osu.Game /// Use to programatically exit the game as if the user was triggering via alt-f4. /// Will keep persisting until an exit occurs (exit may be blocked multiple times). /// - public void GracefullyExit() + public virtual void GracefullyExit() { if (!OnExiting()) Exit();