2016-12-06 09:56:20 +00: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 04:45:16 +00:00
|
|
|
|
using OpenTK.Graphics;
|
2017-01-13 04:49:05 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2016-11-03 04:45:16 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2016-11-07 23:04:49 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2016-11-03 04:45:16 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Options
|
|
|
|
|
{
|
2016-11-04 03:01:11 +00:00
|
|
|
|
public abstract class OptionsSection : Container
|
2016-11-03 04:45:16 +00:00
|
|
|
|
{
|
2016-11-04 03:01:11 +00:00
|
|
|
|
protected FlowContainer content;
|
2016-11-07 12:13:56 +00:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
2016-11-03 04:45:16 +00:00
|
|
|
|
|
2016-11-07 23:04:49 +00:00
|
|
|
|
public abstract FontAwesome Icon { get; }
|
2016-11-09 04:16:04 +00:00
|
|
|
|
public abstract string Header { get; }
|
2016-11-03 04:45:16 +00:00
|
|
|
|
|
2017-01-13 04:49:05 +00:00
|
|
|
|
private SpriteText headerLabel;
|
|
|
|
|
|
2016-11-03 04:45:16 +00:00
|
|
|
|
public OptionsSection()
|
|
|
|
|
{
|
2016-11-15 07:55:23 +00:00
|
|
|
|
Margin = new MarginPadding { Top = 20 };
|
2016-11-03 04:45:16 +00:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2017-01-13 04:49:05 +00:00
|
|
|
|
|
|
|
|
|
const int headerSize = 26, headerMargin = 25;
|
|
|
|
|
const int borderSize = 2;
|
2016-11-03 04:45:16 +00:00
|
|
|
|
AddInternal(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
2016-11-15 07:55:23 +00:00
|
|
|
|
Colour = new Color4(0, 0, 0, 255),
|
2016-11-03 04:45:16 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = borderSize,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
2016-11-15 07:55:23 +00:00
|
|
|
|
Top = 20 + borderSize,
|
2016-11-08 11:07:28 +00:00
|
|
|
|
Left = OptionsOverlay.CONTENT_MARGINS,
|
|
|
|
|
Right = OptionsOverlay.CONTENT_MARGINS,
|
2016-11-03 04:45:16 +00:00
|
|
|
|
Bottom = 10,
|
|
|
|
|
},
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2017-01-13 04:49:05 +00:00
|
|
|
|
headerLabel = new SpriteText
|
2016-11-03 04:45:16 +00:00
|
|
|
|
{
|
|
|
|
|
TextSize = headerSize,
|
2016-11-04 03:01:11 +00:00
|
|
|
|
Text = Header,
|
2016-11-03 04:45:16 +00:00
|
|
|
|
},
|
|
|
|
|
content = new FlowContainer
|
|
|
|
|
{
|
|
|
|
|
Margin = new MarginPadding { Top = headerSize + headerMargin },
|
|
|
|
|
Direction = FlowDirection.VerticalOnly,
|
2016-11-15 07:55:23 +00:00
|
|
|
|
Spacing = new Vector2(0, 50),
|
2016-11-03 04:45:16 +00:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-01-13 04:49:05 +00:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
headerLabel.Colour = colours.Pink;
|
|
|
|
|
}
|
2016-11-03 04:45:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|