mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Make sure intro can't be exited unless the main menu has displayed once.
This commit is contained in:
parent
c5228b63cb
commit
08728b84d1
@ -9,6 +9,8 @@ using System.Threading.Tasks;
|
||||
using osu.Framework.GameModes;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.GameModes
|
||||
{
|
||||
@ -46,12 +48,12 @@ namespace osu.Game.GameModes
|
||||
base.OnSuspending(next);
|
||||
}
|
||||
|
||||
protected override void OnExiting(GameMode next)
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
Content.FadeOut(transition_length, EasingTypes.OutExpo);
|
||||
Content.MoveToX(x_movement_amount, transition_length, EasingTypes.OutExpo);
|
||||
|
||||
base.OnExiting(next);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
protected override void OnResuming(GameMode last)
|
||||
|
@ -22,10 +22,10 @@ namespace osu.Game.GameModes.Edit
|
||||
Background.FadeColour(Color4.DarkGray, 500);
|
||||
}
|
||||
|
||||
protected override void OnExiting(GameMode next)
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
base.OnExiting(next);
|
||||
Background.FadeColour(Color4.White, 500);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ namespace osu.Game.GameModes
|
||||
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
||||
}
|
||||
|
||||
protected override void OnExiting(GameMode next)
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
base.OnExiting(next);
|
||||
|
||||
textContainer.MoveTo(new Vector2((Size.X / 16), 0), transition_time, EasingTypes.OutExpo);
|
||||
Content.FadeOut(transition_time, EasingTypes.OutExpo);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
protected override void OnSuspending(GameMode next)
|
||||
|
@ -15,6 +15,8 @@ namespace osu.Game.GameModes.Menu
|
||||
class Intro : OsuGameMode
|
||||
{
|
||||
private OsuLogo logo;
|
||||
private bool didLoadMenu;
|
||||
|
||||
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
||||
|
||||
public override void Load()
|
||||
@ -52,6 +54,7 @@ namespace osu.Game.GameModes.Menu
|
||||
|
||||
Game.Scheduler.AddDelayed(delegate
|
||||
{
|
||||
didLoadMenu = true;
|
||||
Push(new MainMenu());
|
||||
}, 2900);
|
||||
|
||||
@ -67,6 +70,12 @@ namespace osu.Game.GameModes.Menu
|
||||
base.OnSuspending(next);
|
||||
}
|
||||
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
//cancel exiting if we haven't loaded the menu yet.
|
||||
return !didLoadMenu;
|
||||
}
|
||||
|
||||
protected override void OnResuming(GameMode last)
|
||||
{
|
||||
//we are just an intro. if we are resumed, we just want to exit after a short delay (to allow the last mode to transition out).
|
||||
|
@ -28,10 +28,10 @@ namespace osu.Game.GameModes.Multiplayer
|
||||
Background.FadeColour(Color4.DarkGray, 500);
|
||||
}
|
||||
|
||||
protected override void OnExiting(GameMode next)
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
base.OnExiting(next);
|
||||
Background.FadeColour(Color4.White, 500);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ namespace osu.Game.GameModes
|
||||
base.OnEntering(last);
|
||||
}
|
||||
|
||||
protected override void OnExiting(GameMode next)
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
OsuGameMode nextOsu = next as OsuGameMode;
|
||||
|
||||
if (Background != null && !Background.Equals(nextOsu?.Background))
|
||||
Background.Exit();
|
||||
|
||||
base.OnExiting(next);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ namespace osu.Game.GameModes.Play
|
||||
Background.FadeColour(Color4.DarkGray, 500);
|
||||
}
|
||||
|
||||
protected override void OnExiting(GameMode next)
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
base.OnExiting(next);
|
||||
Background.FadeColour(Color4.White, 500);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ namespace osu.Game.GameModes.Play
|
||||
Background.FadeColour(Color4.DarkGray, 500);
|
||||
}
|
||||
|
||||
protected override void OnExiting(GameMode next)
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
base.OnExiting(next);
|
||||
Background.FadeColour(Color4.White, 500);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user