1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:23:20 +08:00

Ensure game is at main menu before performing exit on screen

This commit is contained in:
Dean Herbert 2020-02-11 22:37:38 +09:00
parent 804d210250
commit 2a67246b21
2 changed files with 5 additions and 2 deletions

View File

@ -446,7 +446,7 @@ namespace osu.Game
/// </summary>
/// <param name="action">The action to perform once we are in the correct state.</param>
/// <param name="validScreens">An optional collection of valid screen types. If any of these screens are already current we can perform the action immediately, else the first valid parent will be made current before performing the action. <see cref="MainMenu"/> is used if not specified.</param>
protected void PerformFromScreen(Action<IScreen> action, IEnumerable<Type> validScreens = null)
public void PerformFromScreen(Action<IScreen> action, IEnumerable<Type> validScreens = null)
{
performFromMainMenuTask?.Cancel();

View File

@ -141,12 +141,15 @@ namespace osu.Game.Screens.Menu
preloadSongSelect();
}
[Resolved]
private OsuGame game { get; set; }
private void confirmAndExit()
{
if (exitConfirmed) return;
exitConfirmed = true;
this.Exit();
game.PerformFromScreen(menu => menu.Exit());
}
private void preloadSongSelect()