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
|
2017-02-07 12:52:19 +08:00
|
|
|
|
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2017-05-08 02:35:57 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2017-02-07 12:52:19 +08:00
|
|
|
|
|
2017-05-15 09:55:29 +08:00
|
|
|
|
namespace osu.Game.Overlays.Settings
|
2017-02-07 12:52:19 +08:00
|
|
|
|
{
|
2017-05-15 09:55:29 +08:00
|
|
|
|
public abstract class SettingsSubsection : FillFlowContainer, IHasFilterableChildren
|
2017-02-07 12:52:19 +08:00
|
|
|
|
{
|
2017-03-09 13:25:49 +08:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
2017-03-23 12:41:50 +08:00
|
|
|
|
private readonly Container<Drawable> content;
|
2017-02-07 12:52:19 +08:00
|
|
|
|
|
|
|
|
|
protected abstract string Header { get; }
|
|
|
|
|
|
2017-05-08 02:35:57 +08:00
|
|
|
|
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
|
|
|
|
public string[] FilterTerms => new[] { Header };
|
2017-05-30 15:33:26 +08:00
|
|
|
|
public bool MatchingFilter
|
2017-05-08 02:35:57 +08:00
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
FadeTo(value ? 1 : 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-15 09:55:29 +08:00
|
|
|
|
protected SettingsSubsection()
|
2017-02-07 12:52:19 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2017-03-04 18:00:17 +08:00
|
|
|
|
Direction = FillDirection.Vertical;
|
2017-02-07 12:52:19 +08:00
|
|
|
|
AddInternal(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = Header.ToUpper(),
|
|
|
|
|
Margin = new MarginPadding { Bottom = 10 },
|
|
|
|
|
Font = @"Exo2.0-Black",
|
|
|
|
|
},
|
2017-03-09 13:25:49 +08:00
|
|
|
|
content = new FillFlowContainer
|
2017-02-07 12:52:19 +08:00
|
|
|
|
{
|
2017-03-04 18:00:17 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-03-02 02:33:01 +08:00
|
|
|
|
Spacing = new Vector2(0, 5),
|
2017-02-07 12:52:19 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|