diff --git a/osu.Game/GameModes/Menu/MainMenu.cs b/osu.Game/GameModes/Menu/MainMenu.cs index f6f9a79bf1..f029d0b8ef 100644 --- a/osu.Game/GameModes/Menu/MainMenu.cs +++ b/osu.Game/GameModes/Menu/MainMenu.cs @@ -14,6 +14,7 @@ using osu.Game.GameModes.Play; using osu.Game.Graphics.Containers; using OpenTK; using osu.Framework; +using osu.Game.Overlays; namespace osu.Game.GameModes.Menu { @@ -48,7 +49,7 @@ namespace osu.Game.GameModes.Menu OnTest = delegate { Push(new TestBrowser()); }, OnExit = delegate { Scheduler.AddDelayed(Exit, ButtonSystem.EXIT_DELAY); }, OnSettings = delegate { - osu.Options.PoppedOut = !osu.Options.PoppedOut; + osu.Options.State = osu.Options.State.Reverse(); }, } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4c1d2e1b98..6fb8e8f8ba 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -96,7 +96,7 @@ namespace osu.Game Toolbar = new Toolbar { OnHome = delegate { MainMenu?.MakeCurrent(); }, - OnSettings = delegate { Options.PoppedOut = !Options.PoppedOut; }, + OnSettings = delegate { Options.State = Options.State.Reverse(); }, OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; }, Alpha = 0.001f, }, diff --git a/osu.Game/Overlays/Options.cs b/osu.Game/Overlays/Options.cs index bdab31bc6e..6722b0abf6 100644 --- a/osu.Game/Overlays/Options.cs +++ b/osu.Game/Overlays/Options.cs @@ -13,7 +13,7 @@ using osu.Framework; namespace osu.Game.Overlays { - public class Options : Container + public class Options : Container, IStateful { const float width = 300; @@ -41,35 +41,35 @@ namespace osu.Game.Overlays switch (args.Key) { case Key.Escape: - if (!poppedOut) return false; + if (State == Visibility.Hidden) return false; - PoppedOut = false; + State = Visibility.Hidden; return true; } return base.OnKeyDown(state, args); } - private bool poppedOut; + private Visibility state; - public bool PoppedOut + public Visibility State { - get { return poppedOut; } + get { return state; } set { - if (value == poppedOut) return; + if (value == state) return; - poppedOut = value; + state = value; - if (poppedOut) + switch (state) { - MoveTo(new Vector2(0, 0), 300, EasingTypes.Out); + case Visibility.Hidden: + MoveTo(new Vector2(-width, 0), 300, EasingTypes.Out); + break; + case Visibility.Visible: + MoveTo(new Vector2(0, 0), 300, EasingTypes.Out); + break; } - else - { - MoveTo(new Vector2(-width, 0), 300, EasingTypes.Out); - } - } } }