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
{
public class OptionsSidebar : Container
public class Sidebar : Container
{
private FlowContainer content;
internal const int default_width = 60, expanded_width = 200;
protected override Container<Drawable> Content => content;
public OptionsSidebar()
public Sidebar()
{
RelativeSizeAxes = Axes.Y;
InternalChildren = new Drawable[]

View File

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

View File

@ -29,14 +29,14 @@ namespace osu.Game.Overlays
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 sidebar_padding = 10;
private ScrollContainer scrollContainer;
private OptionsSidebar sidebar;
private Sidebar sidebar;
private SidebarButton[] sidebarButtons;
private OptionsSection[] sections;
private float lastKnownScroll;
@ -110,7 +110,7 @@ namespace osu.Game.Overlays
}
}
},
sidebar = new OptionsSidebar
sidebar = new Sidebar
{
Width = SIDEBAR_WIDTH,
Children = sidebarButtons = sections.Select(section =>

View File

@ -198,7 +198,7 @@
<Compile Include="Overlays\Options\OptionsSection.cs" />
<Compile Include="Overlays\Options\OptionsSubsection.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\General\LoginOptions.cs" />
<Compile Include="Overlays\Options\Sections\General\UpdateOptions.cs" />