From 481b9d3208986210f8e76a3d4d9396f1f7cc4f55 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 30 Nov 2016 18:28:08 +0900 Subject: [PATCH] Make opening options shift the rest of the screen as per design. --- osu.Game/OsuGame.cs | 14 ++++++++++++++ osu.Game/Overlays/OptionsOverlay.cs | 22 +++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3c5c27ecb9..b979501b26 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -19,6 +19,7 @@ using osu.Framework.Logging; using osu.Game.Graphics.UserInterface.Volume; using osu.Game.Database; using osu.Framework.Allocation; +using osu.Framework.Graphics.Transformations; using osu.Game.Modes; using osu.Game.Screens; using osu.Game.Screens.Menu; @@ -132,6 +133,19 @@ namespace osu.Game overlayContent.Add(Toolbar); }); + Options.StateChanged += delegate + { + switch (Options.State) + { + case Visibility.Hidden: + intro.MoveToX(0, OptionsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint); + break; + case Visibility.Visible: + intro.MoveToX(OptionsOverlay.SIDEBAR_WIDTH / 2, OptionsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint); + break; + } + }; + Cursor.Alpha = 0; } diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index e3039ad781..33677799f1 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -30,8 +30,12 @@ namespace osu.Game.Overlays { internal const float CONTENT_MARGINS = 10; + public const float TRANSITION_LENGTH = 600; + + public const float SIDEBAR_WIDTH = OptionsSidebar.default_width; + private const float width = 400; - private const float sidebar_width = OptionsSidebar.default_width; + private const float sidebar_padding = 10; private ScrollContainer scrollContainer; @@ -71,7 +75,7 @@ namespace osu.Game.Overlays ScrollDraggerVisible = false, RelativeSizeAxes = Axes.Y, Width = width, - Margin = new MarginPadding { Left = sidebar_width }, + Margin = new MarginPadding { Left = SIDEBAR_WIDTH }, Children = new[] { new FlowContainer @@ -108,7 +112,7 @@ namespace osu.Game.Overlays }, sidebar = new OptionsSidebar { - Width = sidebar_width, + Width = SIDEBAR_WIDTH, Children = sidebarButtons = sections.Select(section => new SidebarButton { @@ -175,16 +179,16 @@ namespace osu.Game.Overlays protected override void PopIn() { - scrollContainer.MoveToX(0, 600, EasingTypes.OutQuint); - sidebar.MoveToX(0, 800, EasingTypes.OutQuint); - FadeTo(1, 300); + scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); + sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); + FadeTo(1, TRANSITION_LENGTH / 2); } protected override void PopOut() { - scrollContainer.MoveToX(-width, 600, EasingTypes.OutQuint); - sidebar.MoveToX(-sidebar_width, 600, EasingTypes.OutQuint); - FadeTo(0, 300); + scrollContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint); + sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint); + FadeTo(0, TRANSITION_LENGTH / 2); } } }