Make opening options shift the rest of the screen as per design.

This commit is contained in:
Dean Herbert 2016-11-30 18:28:08 +09:00
parent c26587ec3a
commit 481b9d3208
2 changed files with 27 additions and 9 deletions

View File

@ -19,6 +19,7 @@ using osu.Framework.Logging;
using osu.Game.Graphics.UserInterface.Volume; using osu.Game.Graphics.UserInterface.Volume;
using osu.Game.Database; using osu.Game.Database;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Transformations;
using osu.Game.Modes; using osu.Game.Modes;
using osu.Game.Screens; using osu.Game.Screens;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
@ -132,6 +133,19 @@ namespace osu.Game
overlayContent.Add(Toolbar); 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; Cursor.Alpha = 0;
} }

View File

@ -30,8 +30,12 @@ namespace osu.Game.Overlays
{ {
internal const float CONTENT_MARGINS = 10; 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 width = 400;
private const float sidebar_width = OptionsSidebar.default_width;
private const float sidebar_padding = 10; private const float sidebar_padding = 10;
private ScrollContainer scrollContainer; private ScrollContainer scrollContainer;
@ -71,7 +75,7 @@ namespace osu.Game.Overlays
ScrollDraggerVisible = false, ScrollDraggerVisible = false,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = width, Width = width,
Margin = new MarginPadding { Left = sidebar_width }, Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
Children = new[] Children = new[]
{ {
new FlowContainer new FlowContainer
@ -108,7 +112,7 @@ namespace osu.Game.Overlays
}, },
sidebar = new OptionsSidebar sidebar = new OptionsSidebar
{ {
Width = sidebar_width, Width = SIDEBAR_WIDTH,
Children = sidebarButtons = sections.Select(section => Children = sidebarButtons = sections.Select(section =>
new SidebarButton new SidebarButton
{ {
@ -175,16 +179,16 @@ namespace osu.Game.Overlays
protected override void PopIn() protected override void PopIn()
{ {
scrollContainer.MoveToX(0, 600, EasingTypes.OutQuint); scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
sidebar.MoveToX(0, 800, EasingTypes.OutQuint); sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint);
FadeTo(1, 300); FadeTo(1, TRANSITION_LENGTH / 2);
} }
protected override void PopOut() protected override void PopOut()
{ {
scrollContainer.MoveToX(-width, 600, EasingTypes.OutQuint); scrollContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint);
sidebar.MoveToX(-sidebar_width, 600, EasingTypes.OutQuint); sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint);
FadeTo(0, 300); FadeTo(0, TRANSITION_LENGTH / 2);
} }
} }
} }