mirror of https://github.com/ppy/osu
Block window closing while intro is playing.
This commit is contained in:
parent
f2f3b69eee
commit
243d2cdec5
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue