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:
parent
804d210250
commit
2a67246b21
@ -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();
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user