1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 02:07:24 +08:00
osu-lazer/osu.Game/Overlays/Options/OptionsSection.cs

79 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 17:56:20 +08: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
{
protected FlowContainer content;
protected override Container<Drawable> Content => content;
public abstract FontAwesome Icon { get; }
2016-11-09 12:16:04 +08:00
public abstract string Header { get; }
private SpriteText headerLabel;
public OptionsSection()
{
2016-11-15 15:55:23 +08:00
Margin = new MarginPadding { Top = 20 };
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
const int headerSize = 26, headerMargin = 25;
const int borderSize = 2;
AddInternal(new Drawable[]
{
new Box
{
2016-11-15 15:55:23 +08:00
Colour = new Color4(0, 0, 0, 255),
RelativeSizeAxes = Axes.X,
Height = borderSize,
},
new Container
{
Padding = new MarginPadding
{
2016-11-15 15:55:23 +08:00
Top = 20 + borderSize,
Left = OptionsOverlay.CONTENT_MARGINS,
Right = OptionsOverlay.CONTENT_MARGINS,
Bottom = 10,
},
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
headerLabel = new OsuSpriteText
{
TextSize = headerSize,
Text = Header,
},
content = new FlowContainer
{
Margin = new MarginPadding { Top = headerSize + headerMargin },
Direction = FlowDirection.VerticalOnly,
Spacing = new Vector2(0, 30),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
}
},
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
2017-01-31 18:58:22 +08:00
headerLabel.Colour = colours.Yellow;
}
}
}