1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 10:02:59 +08:00

Fix paddings, transitions, const variable names.

This commit is contained in:
Dean Herbert 2016-11-08 20:07:28 +09:00
parent 97f3023cd9
commit 3ef26a6bf0
3 changed files with 38 additions and 31 deletions

View File

@ -35,8 +35,8 @@ namespace osu.Game.Overlays.Options
Padding = new MarginPadding Padding = new MarginPadding
{ {
Top = 10 + borderSize, Top = 10 + borderSize,
Left = OptionsOverlay.SideMargins, Left = OptionsOverlay.CONTENT_MARGINS,
Right = OptionsOverlay.SideMargins, Right = OptionsOverlay.CONTENT_MARGINS,
Bottom = 10, Bottom = 10,
}, },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -19,6 +19,11 @@ namespace osu.Game.Overlays.Options
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
},
new SidebarScrollContainer new SidebarScrollContainer
{ {
Children = new [] Children = new []
@ -33,14 +38,6 @@ namespace osu.Game.Overlays.Options
} }
} }
}, },
new Box
{
Colour = new Color4(30, 30, 30, 255),
RelativeSizeAxes = Axes.Y,
Width = 2,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
}
}; };
} }

View File

@ -24,20 +24,18 @@ namespace osu.Game.Overlays
{ {
public class OptionsOverlay : OverlayContainer public class OptionsOverlay : OverlayContainer
{ {
internal const float SideMargins = 10; internal const float CONTENT_MARGINS = 10;
private const float width = 400; private const float width = 400;
private const float sideNavWidth = 60; private const float sidebar_width = 60;
private const float sideNavPadding = 0; private const float sidebar_padding = 10;
private const float sidebar_total = sidebar_width + sidebar_padding;
private ScrollContainer scrollContainer; private ScrollContainer scrollContainer;
private FlowContainer flowContainer; private OptionsSidebar sidebar;
public OptionsOverlay() public OptionsOverlay()
{ {
RelativeSizeAxes = Axes.Y;
Size = new Vector2(width, 1);
Position = new Vector2(-width, 0);
var sections = new OptionsSection[] var sections = new OptionsSection[]
{ {
new GeneralSection(), new GeneralSection(),
@ -51,20 +49,23 @@ namespace osu.Game.Overlays
new MaintenanceSection(), new MaintenanceSection(),
}; };
RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X;
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black, Colour = Color4.Black,
Alpha = 0.8f, Alpha = 0.6f,
}, },
scrollContainer = new ScrollContainer scrollContainer = new PaddedScrollContainer
{ {
ScrollDraggerAnchor = Anchor.TopLeft, ScrollDraggerAnchor = Anchor.TopLeft,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = width - (sideNavWidth + sideNavPadding * 2), Width = width,
Position = new Vector2(sideNavWidth + sideNavPadding * 2, 0), Padding = new MarginPadding { Left = sidebar_width },
Children = new[] Children = new[]
{ {
new FlowContainer new FlowContainer
@ -78,29 +79,29 @@ namespace osu.Game.Overlays
{ {
Text = "settings", Text = "settings",
TextSize = 40, TextSize = 40,
Margin = new MarginPadding { Left = SideMargins, Top = 30 }, Margin = new MarginPadding { Left = CONTENT_MARGINS, Top = 30 },
}, },
new SpriteText new SpriteText
{ {
Colour = new Color4(235, 117, 139, 255), Colour = new Color4(235, 117, 139, 255),
Text = "Change the way osu! behaves", Text = "Change the way osu! behaves",
TextSize = 18, TextSize = 18,
Margin = new MarginPadding { Left = SideMargins, Bottom = 30 }, Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 },
}, },
flowContainer = new FlowContainer new FlowContainer
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Direction = FlowDirection.VerticalOnly, Direction = FlowDirection.VerticalOnly,
Children = sections,
} }
} }
} }
} }
}, },
new OptionsSidebar sidebar = new OptionsSidebar
{ {
Padding = new MarginPadding { Left = sideNavPadding, Right = sideNavPadding }, Width = sidebar_width,
Width = sideNavWidth + sideNavPadding * 2,
Children = sections.Select(section => Children = sections.Select(section =>
new OptionsSidebar.SidebarButton new OptionsSidebar.SidebarButton
{ {
@ -110,7 +111,6 @@ namespace osu.Game.Overlays
) )
} }
}; };
flowContainer.Add(sections);
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
@ -129,14 +129,24 @@ namespace osu.Game.Overlays
protected override void PopIn() protected override void PopIn()
{ {
MoveToX(0, 300, EasingTypes.Out); scrollContainer.MoveToX(0, 600, EasingTypes.OutQuint);
sidebar.MoveToX(0, 800, EasingTypes.OutQuint);
FadeTo(1, 300); FadeTo(1, 300);
} }
protected override void PopOut() protected override void PopOut()
{ {
MoveToX(-width, 300, EasingTypes.Out); scrollContainer.MoveToX(-width, 600, EasingTypes.OutQuint);
sidebar.MoveToX(-sidebar_width, 600, EasingTypes.OutQuint);
FadeTo(0, 300); FadeTo(0, 300);
} }
private class PaddedScrollContainer : ScrollContainer
{
public PaddedScrollContainer()
{
Content.Padding = new MarginPadding { Left = sidebar_padding };
}
}
} }
} }