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