2016-11-05 07:27:41 +08:00
|
|
|
|
using System;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2016-11-08 07:04:49 +08:00
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
using osu.Game.Graphics;
|
2016-11-05 07:27:41 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Options
|
|
|
|
|
{
|
|
|
|
|
public class OptionsSideNav : Container
|
|
|
|
|
{
|
2016-11-08 07:04:49 +08:00
|
|
|
|
private FlowContainer content;
|
|
|
|
|
protected override Container Content => content;
|
|
|
|
|
|
2016-11-05 07:27:41 +08:00
|
|
|
|
public OptionsSideNav()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Y;
|
2016-11-08 07:04:49 +08:00
|
|
|
|
InternalChildren = new Drawable[]
|
2016-11-05 07:27:41 +08:00
|
|
|
|
{
|
2016-11-08 07:04:49 +08:00
|
|
|
|
content = new FlowContainer
|
2016-11-05 07:27:41 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
2016-11-08 07:04:49 +08:00
|
|
|
|
Direction = FlowDirection.VerticalOnly
|
2016-11-05 07:27:41 +08:00
|
|
|
|
},
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
Colour = new Color4(30, 30, 30, 255),
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Width = 2,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-08 07:04:49 +08:00
|
|
|
|
public class SidebarButton : Container
|
2016-11-05 07:27:41 +08:00
|
|
|
|
{
|
2016-11-08 07:04:49 +08:00
|
|
|
|
private TextAwesome drawableIcon;
|
|
|
|
|
private Box backgroundBox;
|
|
|
|
|
public Action Action;
|
|
|
|
|
|
|
|
|
|
public FontAwesome Icon
|
|
|
|
|
{
|
|
|
|
|
get { return drawableIcon.Icon; }
|
|
|
|
|
set { drawableIcon.Icon = value; }
|
|
|
|
|
}
|
2016-11-05 07:27:41 +08:00
|
|
|
|
|
2016-11-08 07:04:49 +08:00
|
|
|
|
public SidebarButton()
|
2016-11-05 07:27:41 +08:00
|
|
|
|
{
|
2016-11-08 07:04:49 +08:00
|
|
|
|
Size = new Vector2(60);
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
backgroundBox = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
BlendingMode = BlendingMode.Additive,
|
|
|
|
|
Colour = new Color4(60, 60, 60, 255),
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
},
|
|
|
|
|
drawableIcon = new TextAwesome
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2016-11-08 10:24:41 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2016-11-08 07:04:49 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
2016-11-05 07:27:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-08 07:04:49 +08:00
|
|
|
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs e)
|
2016-11-05 07:27:41 +08:00
|
|
|
|
{
|
2016-11-08 07:04:49 +08:00
|
|
|
|
Action?.Invoke();
|
|
|
|
|
backgroundBox.FlashColour(Color4.White, 400);
|
|
|
|
|
return true;
|
2016-11-05 07:27:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-08 07:04:49 +08:00
|
|
|
|
protected override bool OnHover(InputState state)
|
2016-11-05 07:27:41 +08:00
|
|
|
|
{
|
2016-11-08 07:04:49 +08:00
|
|
|
|
backgroundBox.FadeTo(0.4f, 200);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHoverLost(InputState state)
|
|
|
|
|
{
|
|
|
|
|
backgroundBox.FadeTo(0, 200);
|
2016-11-05 07:27:41 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|