From 9e8b4d43dddc87e3a72b76542d8b9cdef7daa3b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Feb 2017 15:33:08 +0900 Subject: [PATCH] Improve exit procedure. --- osu.Game/OsuGame.cs | 7 ++----- osu.Game/Screens/Menu/ButtonSystem.cs | 22 +++++++--------------- osu.Game/Screens/Menu/Intro.cs | 5 ++++- osu.Game/Screens/Menu/MainMenu.cs | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 2cce0aa0ce..691ff285db 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -235,17 +235,14 @@ namespace osu.Game ModeChanged?.Invoke(newMode); if (newMode == null) - Host.Exit(); + Exit(); } protected override bool OnExiting() { if (!intro.DidLoadMenu || intro.ChildGameMode != null) { - Scheduler.Add(delegate - { - intro.MakeCurrent(); - }); + Scheduler.Add(intro.MakeCurrent); return true; } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 9a84a79333..fe3a45d33a 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -218,6 +218,7 @@ namespace osu.Game.Screens.Menu switch (state) { + case MenuState.Exit: case MenuState.Initial: toolbar?.Hide(); @@ -233,6 +234,12 @@ namespace osu.Game.Screens.Menu foreach (Button b in buttonsPlay) b.State = ButtonState.Contracted; + + if (state == MenuState.Exit) + { + osuLogo.RotateTo(20, EXIT_DELAY * 1.5f); + osuLogo.FadeOut(EXIT_DELAY); + } break; case MenuState.TopLevel: buttonArea.Flush(true); @@ -276,21 +283,6 @@ namespace osu.Game.Screens.Menu foreach (Button b in buttonsPlay) b.State = ButtonState.Contracted; break; - case MenuState.Exit: - buttonArea.FadeOut(200); - - foreach (Button b in buttonsTopLevel) - b.State = ButtonState.Contracted; - - foreach (Button b in buttonsPlay) - b.State = ButtonState.Contracted; - - osuLogo.Delay(150); - - osuLogo.ScaleTo(1f, EXIT_DELAY * 1.5f); - osuLogo.RotateTo(20, EXIT_DELAY * 1.5f); - osuLogo.FadeOut(EXIT_DELAY); - break; } backButton.State = state == MenuState.Play ? ButtonState.Expanded : ButtonState.Contracted; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index cb3cfe0208..d3d376e4b0 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -109,10 +109,13 @@ namespace osu.Game.Screens.Menu protected override void OnResuming(GameMode last) { + if (!(last is MainMenu)) + Content.FadeIn(300); + //we also handle the exit transition. seeya.Play(); - double fadeOutTime = (last.LifetimeEnd - Time.Current) + 100; + double fadeOutTime = 2000; Scheduler.AddDelayed(Exit, fadeOutTime); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index f672a3998b..8db6b6c8d8 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -95,7 +95,7 @@ namespace osu.Game.Screens.Menu protected override bool OnExiting(GameMode next) { buttons.State = MenuState.Exit; - Content.FadeOut(ButtonSystem.EXIT_DELAY); + Content.FadeOut(3000); return base.OnExiting(next); } }