osu/osu.Game/Overlays/Options/OptionsSection.cs

80 lines
2.7 KiB
C#
Raw Normal View History

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