mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 19:22:56 +08:00
Merge pull request #18760 from peppy/reidrect-graceful-exit
Redirect graceful exiting to standard exit flow
This commit is contained in:
commit
9518e1db05
@ -154,7 +154,7 @@ namespace osu.Desktop.Updater
|
||||
Activated = () =>
|
||||
{
|
||||
updateManager.PrepareUpdateAsync()
|
||||
.ContinueWith(_ => updateManager.Schedule(() => game?.GracefullyExit()));
|
||||
.ContinueWith(_ => updateManager.Schedule(() => game?.AttemptExit()));
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
dropdown.Items = storage.ListTournaments();
|
||||
dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true);
|
||||
|
||||
Action = () => game.GracefullyExit();
|
||||
Action = () => game.AttemptExit();
|
||||
folderButton.Action = () => storage.PresentExternally();
|
||||
|
||||
ButtonText = "Close osu!";
|
||||
|
@ -637,6 +637,12 @@ namespace osu.Game
|
||||
Add(performFromMainMenuTask = new PerformFromMenuRunner(action, validScreens, () => ScreenStack.CurrentScreen));
|
||||
}
|
||||
|
||||
public override void AttemptExit()
|
||||
{
|
||||
// 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>
|
||||
|
@ -417,14 +417,15 @@ namespace osu.Game
|
||||
|
||||
/// <summary>
|
||||
/// 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).
|
||||
/// By default, will keep persisting until an exit occurs (exit may be blocked multiple times).
|
||||
/// May be interrupted (see <see cref="OsuGame"/>'s override).
|
||||
/// </summary>
|
||||
public void GracefullyExit()
|
||||
public virtual void AttemptExit()
|
||||
{
|
||||
if (!OnExiting())
|
||||
Exit();
|
||||
else
|
||||
Scheduler.AddDelayed(GracefullyExit, 2000);
|
||||
Scheduler.AddDelayed(AttemptExit, 2000);
|
||||
}
|
||||
|
||||
public bool Migrate(string path)
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
dialogOverlay.Push(new ConfirmDialog("To complete this operation, osu! will close. Please open it again to use the new data location.", () =>
|
||||
{
|
||||
(storage as OsuStorage)?.ChangeDataPath(target.FullName);
|
||||
game.GracefullyExit();
|
||||
game.Exit();
|
||||
}, () => { }));
|
||||
},
|
||||
() => { }));
|
||||
|
Loading…
Reference in New Issue
Block a user