Block window closing while intro is playing.

This commit is contained in:
Dean Herbert 2016-10-07 19:12:36 +09:00
parent f2f3b69eee
commit 243d2cdec5
2 changed files with 18 additions and 3 deletions

View File

@ -15,7 +15,11 @@ namespace osu.Game.GameModes.Menu
class Intro : OsuGameMode
{
private OsuLogo logo;
private bool didLoadMenu;
/// <summary>
/// Whether we have loaded the menu previously.
/// </summary>
internal bool DidLoadMenu;
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
@ -54,7 +58,7 @@ public override void Load()
Game.Scheduler.AddDelayed(delegate
{
didLoadMenu = true;
DidLoadMenu = true;
Push(new MainMenu());
}, 2900);
@ -73,7 +77,7 @@ protected override void OnSuspending(GameMode next)
protected override bool OnExiting(GameMode next)
{
//cancel exiting if we haven't loaded the menu yet.
return !didLoadMenu;
return !DidLoadMenu;
}
protected override void OnResuming(GameMode last)

View File

@ -95,6 +95,17 @@ private void modeChanged(GameMode newMode)
Host.Exit();
}
protected override bool OnExiting()
{
if (!intro.DidLoadMenu || intro.ChildGameMode != null)
{
intro.MakeCurrent();
return true;
}
return base.OnExiting();
}
private void modeAdded(GameMode newMode)
{
newMode.ModePushed += modeAdded;