2016-12-06 17:56:20 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using OpenTK;
|
2016-11-03 12:45:16 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2017-01-13 12:49:05 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2016-11-03 12:45:16 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2016-11-08 07:04:49 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2017-01-31 17:53:52 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2016-11-03 12:45:16 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Options
|
|
|
|
|
{
|
2016-11-04 11:01:11 +08:00
|
|
|
|
public abstract class OptionsSection : Container
|
2016-11-03 12:45:16 +08:00
|
|
|
|
{
|
2016-11-04 11:01:11 +08:00
|
|
|
|
protected FlowContainer content;
|
2016-11-07 20:13:56 +08:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
2016-11-03 12:45:16 +08:00
|
|
|
|
|
2016-11-08 07:04:49 +08:00
|
|
|
|
public abstract FontAwesome Icon { get; }
|
2016-11-09 12:16:04 +08:00
|
|
|
|
public abstract string Header { get; }
|
2016-11-03 12:45:16 +08:00
|
|
|
|
|
2017-01-13 12:49:05 +08:00
|
|
|
|
private SpriteText headerLabel;
|
|
|
|
|
|
2016-11-03 12:45:16 +08:00
|
|
|
|
public OptionsSection()
|
|
|
|
|
{
|
2016-11-15 15:55:23 +08:00
|
|
|
|
Margin = new MarginPadding { Top = 20 };
|
2016-11-03 12:45:16 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2017-01-13 12:49:05 +08:00
|
|
|
|
|
|
|
|
|
const int headerSize = 26, headerMargin = 25;
|
|
|
|
|
const int borderSize = 2;
|
2016-11-03 12:45:16 +08:00
|
|
|
|
AddInternal(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
2016-11-15 15:55:23 +08:00
|
|
|
|
Colour = new Color4(0, 0, 0, 255),
|
2016-11-03 12:45:16 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = borderSize,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
2016-11-15 15:55:23 +08:00
|
|
|
|
Top = 20 + borderSize,
|
2016-11-08 19:07:28 +08:00
|
|
|
|
Left = OptionsOverlay.CONTENT_MARGINS,
|
|
|
|
|
Right = OptionsOverlay.CONTENT_MARGINS,
|
2016-11-03 12:45:16 +08:00
|
|
|
|
Bottom = 10,
|
|
|
|
|
},
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2017-01-31 17:53:52 +08:00
|
|
|
|
headerLabel = new OsuSpriteText
|
2016-11-03 12:45:16 +08:00
|
|
|
|
{
|
|
|
|
|
TextSize = headerSize,
|
2016-11-04 11:01:11 +08:00
|
|
|
|
Text = Header,
|
2016-11-03 12:45:16 +08:00
|
|
|
|
},
|
|
|
|
|
content = new FlowContainer
|
|
|
|
|
{
|
|
|
|
|
Margin = new MarginPadding { Top = headerSize + headerMargin },
|
|
|
|
|
Direction = FlowDirection.VerticalOnly,
|
2017-01-31 18:19:01 +08:00
|
|
|
|
Spacing = new Vector2(0, 30),
|
2016-11-03 12:45:16 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-01-13 12:49:05 +08:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
headerLabel.Colour = colours.Pink;
|
|
|
|
|
}
|
2016-11-03 12:45:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|