2017-02-07 12:59:30 +08:00
|
|
|
|
// 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;
|
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
|
|
|
|
{
|
2017-02-07 15:15:45 +08:00
|
|
|
|
protected FlowContainer FlowContent;
|
|
|
|
|
protected override Container<Drawable> Content => FlowContent;
|
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-02-07 15:15:45 +08:00
|
|
|
|
|
|
|
|
|
const int header_size = 26;
|
|
|
|
|
const int header_margin = 25;
|
|
|
|
|
const int border_size = 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,
|
2017-02-07 15:15:45 +08:00
|
|
|
|
Height = border_size,
|
2016-11-03 12:45:16 +08:00
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
2017-02-07 15:15:45 +08:00
|
|
|
|
Top = 20 + border_size,
|
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
|
|
|
|
{
|
2017-02-07 15:15:45 +08:00
|
|
|
|
TextSize = header_size,
|
2016-11-04 11:01:11 +08:00
|
|
|
|
Text = Header,
|
2016-11-03 12:45:16 +08:00
|
|
|
|
},
|
2017-02-07 15:15:45 +08:00
|
|
|
|
FlowContent = new FlowContainer
|
2016-11-03 12:45:16 +08:00
|
|
|
|
{
|
2017-02-07 15:15:45 +08:00
|
|
|
|
Margin = new MarginPadding { Top = header_size + header_margin },
|
2016-11-03 12:45:16 +08:00
|
|
|
|
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)
|
|
|
|
|
{
|
2017-01-31 18:58:22 +08:00
|
|
|
|
headerLabel.Colour = colours.Yellow;
|
2017-01-13 12:49:05 +08:00
|
|
|
|
}
|
2016-11-03 12:45:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|