Sidebar button style pass.

This commit is contained in:
Dean Herbert 2017-01-31 19:58:38 +09:00
parent 86b61cab8e
commit 6803b1a8db
4 changed files with 22 additions and 15 deletions

View File

@ -14,13 +14,13 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class OptionsSidebar : Container public class Sidebar : Container
{ {
private FlowContainer content; private FlowContainer content;
internal const int default_width = 60, expanded_width = 200; internal const int default_width = 60, expanded_width = 200;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
public OptionsSidebar() public Sidebar()
{ {
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]

View File

@ -20,6 +20,7 @@ namespace osu.Game.Overlays.Options
private SpriteText headerText; private SpriteText headerText;
private Box backgroundBox; private Box backgroundBox;
private Box selectionIndicator; private Box selectionIndicator;
public Container text;
public Action Action; public Action Action;
private OptionsSection section; private OptionsSection section;
@ -45,15 +46,21 @@ namespace osu.Game.Overlays.Options
{ {
selected = value; selected = value;
if (selected) if (selected)
{
selectionIndicator.FadeIn(50); selectionIndicator.FadeIn(50);
text.FadeColour(Color4.White, 50);
}
else else
{
selectionIndicator.FadeOut(50); selectionIndicator.FadeOut(50);
text.FadeColour(OsuColour.Gray(0.6f), 50);
}
} }
} }
public SidebarButton() public SidebarButton()
{ {
Height = OptionsSidebar.default_width; Height = Sidebar.default_width;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Children = new Drawable[] Children = new Drawable[]
{ {
@ -64,12 +71,18 @@ namespace osu.Game.Overlays.Options
Colour = OsuColour.Gray(60), Colour = OsuColour.Gray(60),
Alpha = 0, Alpha = 0,
}, },
new Container text = new Container
{ {
Width = OptionsSidebar.default_width, Width = Sidebar.default_width,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Children = new[] Children = new[]
{ {
headerText = new OsuSpriteText
{
Position = new Vector2(Sidebar.default_width + 10, 0),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
drawableIcon = new TextAwesome drawableIcon = new TextAwesome
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -77,12 +90,6 @@ namespace osu.Game.Overlays.Options
}, },
} }
}, },
headerText = new OsuSpriteText
{
Position = new Vector2(OptionsSidebar.default_width + 10, 0),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
selectionIndicator = new Box selectionIndicator = new Box
{ {
Alpha = 0, Alpha = 0,

View File

@ -29,14 +29,14 @@ namespace osu.Game.Overlays
public const float TRANSITION_LENGTH = 600; public const float TRANSITION_LENGTH = 600;
public const float SIDEBAR_WIDTH = OptionsSidebar.default_width; public const float SIDEBAR_WIDTH = Sidebar.default_width;
private const float width = 400; private const float width = 400;
private const float sidebar_padding = 10; private const float sidebar_padding = 10;
private ScrollContainer scrollContainer; private ScrollContainer scrollContainer;
private OptionsSidebar sidebar; private Sidebar sidebar;
private SidebarButton[] sidebarButtons; private SidebarButton[] sidebarButtons;
private OptionsSection[] sections; private OptionsSection[] sections;
private float lastKnownScroll; private float lastKnownScroll;
@ -110,7 +110,7 @@ namespace osu.Game.Overlays
} }
} }
}, },
sidebar = new OptionsSidebar sidebar = new Sidebar
{ {
Width = SIDEBAR_WIDTH, Width = SIDEBAR_WIDTH,
Children = sidebarButtons = sections.Select(section => Children = sidebarButtons = sections.Select(section =>

View File

@ -198,7 +198,7 @@
<Compile Include="Overlays\Options\OptionsSection.cs" /> <Compile Include="Overlays\Options\OptionsSection.cs" />
<Compile Include="Overlays\Options\OptionsSubsection.cs" /> <Compile Include="Overlays\Options\OptionsSubsection.cs" />
<Compile Include="Graphics\UserInterface\LoadingAnimation.cs" /> <Compile Include="Graphics\UserInterface\LoadingAnimation.cs" />
<Compile Include="Overlays\Options\OptionsSidebar.cs" /> <Compile Include="Overlays\Options\Sidebar.cs" />
<Compile Include="Overlays\Options\Sections\GeneralSection.cs" /> <Compile Include="Overlays\Options\Sections\GeneralSection.cs" />
<Compile Include="Overlays\Options\Sections\General\LoginOptions.cs" /> <Compile Include="Overlays\Options\Sections\General\LoginOptions.cs" />
<Compile Include="Overlays\Options\Sections\General\UpdateOptions.cs" /> <Compile Include="Overlays\Options\Sections\General\UpdateOptions.cs" />