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
This commit is contained in:
Dean Herbert 2022-06-18 22:59:19 +09:00
parent cbc218200a
commit 56abe54fe6
2 changed files with 7 additions and 1 deletions

View File

@ -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());
}
/// <summary>
/// Wait for the game (and target component) to become loaded and then run an action.
/// </summary>

View File

@ -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).
/// </summary>
public void GracefullyExit()
public virtual void GracefullyExit()
{
if (!OnExiting())
Exit();