1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:43:04 +08:00

Centralise toolbar size variables and adjust to design.

This commit is contained in:
Dean Herbert 2017-02-08 20:14:17 +09:00
parent 143cfae93a
commit b6398a1c77
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
4 changed files with 11 additions and 6 deletions

View File

@ -11,13 +11,14 @@ using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays.Toolbar;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class Sidebar : Container public class Sidebar : Container
{ {
private FlowContainer content; private FlowContainer content;
internal const int DEFAULT_WIDTH = 60; internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
internal const int EXPANDED_WIDTH = 200; internal const int EXPANDED_WIDTH = 200;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
public class Toolbar : OverlayContainer public class Toolbar : OverlayContainer
{ {
public const float HEIGHT = 50; public const float HEIGHT = 40;
public Action OnHome; public Action OnHome;
public Action<PlayMode> OnPlayModeChange; public Action<PlayMode> OnPlayModeChange;

View File

@ -21,6 +21,8 @@ namespace osu.Game.Overlays.Toolbar
{ {
public class ToolbarButton : Container public class ToolbarButton : Container
{ {
public const float WIDTH = Toolbar.HEIGHT * 1.4f;
public FontAwesome Icon public FontAwesome Icon
{ {
get { return DrawableIcon.Icon; } get { return DrawableIcon.Icon; }
@ -66,6 +68,9 @@ namespace osu.Game.Overlays.Toolbar
public ToolbarButton() public ToolbarButton()
{ {
Width = WIDTH;
RelativeSizeAxes = Axes.Y;
Children = new Drawable[] Children = new Drawable[]
{ {
HoverBackground = new Box HoverBackground = new Box
@ -80,7 +85,7 @@ namespace osu.Game.Overlays.Toolbar
Direction = FlowDirection.HorizontalOnly, Direction = FlowDirection.HorizontalOnly,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = 20, Right = 20 }, Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 },
Spacing = new Vector2(5), Spacing = new Vector2(5),
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
@ -121,9 +126,6 @@ namespace osu.Game.Overlays.Toolbar
} }
} }
}; };
RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Toolbar
public ToolbarUserButton() public ToolbarUserButton()
{ {
AutoSizeAxes = Axes.X;
DrawableText.Font = @"Exo2.0-MediumItalic"; DrawableText.Font = @"Exo2.0-MediumItalic";
Add(new OpaqueBackground { Depth = 1 }); Add(new OpaqueBackground { Depth = 1 });