From 5e9d55530920b5cf6fdb64cee846b042a9b0c374 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sun, 16 Oct 2016 17:12:37 +0800 Subject: [PATCH 1/2] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index cb420e7f7f..223c5a68dd 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cb420e7f7f4ef9cdda8ae8336d997946384d3732 +Subproject commit 223c5a68dd795ff5859cf29decfeaa87915149fe From f4c381f74512ade8d2865dc5eacdcdf6df6440d2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sun, 16 Oct 2016 17:14:17 +0800 Subject: [PATCH 2/2] Use OverlayContainer in framework. --- osu.Game/Overlays/ChatConsole.cs | 2 +- osu.Game/Overlays/Options.cs | 3 +- osu.Game/Overlays/Overlay.cs | 53 -------------------------------- osu.Game/Overlays/Toolbar.cs | 2 +- osu.Game/osu.Game.csproj | 1 - 5 files changed, 4 insertions(+), 57 deletions(-) delete mode 100644 osu.Game/Overlays/Overlay.cs diff --git a/osu.Game/Overlays/ChatConsole.cs b/osu.Game/Overlays/ChatConsole.cs index 820b9245d3..2876fa19cc 100644 --- a/osu.Game/Overlays/ChatConsole.cs +++ b/osu.Game/Overlays/ChatConsole.cs @@ -20,7 +20,7 @@ using osu.Game.Online.Chat.Display; namespace osu.Game.Overlays { - public class ChatConsole : Overlay + public class ChatConsole : OverlayContainer { private ChannelDisplay channelDisplay; diff --git a/osu.Game/Overlays/Options.cs b/osu.Game/Overlays/Options.cs index 5bcc5e9a16..1031de5084 100644 --- a/osu.Game/Overlays/Options.cs +++ b/osu.Game/Overlays/Options.cs @@ -6,13 +6,14 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Drawables; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; namespace osu.Game.Overlays { - public class Options : Overlay + public class Options : OverlayContainer { private const float width = 300; diff --git a/osu.Game/Overlays/Overlay.cs b/osu.Game/Overlays/Overlay.cs deleted file mode 100644 index 648a78c248..0000000000 --- a/osu.Game/Overlays/Overlay.cs +++ /dev/null @@ -1,53 +0,0 @@ -using osu.Framework; -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Overlays -{ - /// - /// An element which starts hidden and can be toggled to visible. - /// - public abstract class Overlay : Container, IStateful - { - public override void Load(BaseGame game) - { - base.Load(game); - - //TODO: init code using Alpha or IsVisible override to ensure we don't call Load on children before we first get unhidden. - PopOut(); - Flush(); - } - - private Visibility state; - public Visibility State - { - get { return state; } - set - { - if (value == state) return; - state = value; - - switch (value) - { - case Visibility.Hidden: - PopOut(); - break; - case Visibility.Visible: - PopIn(); - break; - } - } - } - - protected abstract void PopIn(); - - protected abstract void PopOut(); - - public void ToggleVisibility() => State = (State == Visibility.Visible ? Visibility.Hidden : Visibility.Visible); - } - - public enum Visibility - { - Hidden, - Visible - } -} diff --git a/osu.Game/Overlays/Toolbar.cs b/osu.Game/Overlays/Toolbar.cs index c4bc9518cc..34861046be 100644 --- a/osu.Game/Overlays/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar.cs @@ -15,7 +15,7 @@ using osu.Game.Graphics; namespace osu.Game.Overlays { - public class Toolbar : Overlay + public class Toolbar : OverlayContainer { private const float height = 50; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f9201e8a32..05e73fc4f1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -156,7 +156,6 @@ -