2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Allocation;
|
2021-03-16 06:57:06 +00:00
|
|
|
|
using osu.Framework.Testing;
|
2019-02-12 04:04:46 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Settings
|
|
|
|
|
{
|
2021-03-16 06:57:06 +00:00
|
|
|
|
[ExcludeFromDynamicCompile]
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public abstract class SettingsSubsection : FillFlowContainer, IHasFilterableChildren
|
|
|
|
|
{
|
|
|
|
|
protected override Container<Drawable> Content => FlowContent;
|
|
|
|
|
|
|
|
|
|
protected readonly FillFlowContainer FlowContent;
|
|
|
|
|
|
|
|
|
|
protected abstract string Header { get; }
|
|
|
|
|
|
|
|
|
|
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
2019-11-20 18:03:31 +00:00
|
|
|
|
public virtual IEnumerable<string> FilterTerms => new[] { Header };
|
2019-02-28 04:31:40 +00:00
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
public bool MatchingFilter
|
|
|
|
|
{
|
2019-02-28 04:58:19 +00:00
|
|
|
|
set => this.FadeTo(value ? 1 : 0);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-28 15:29:07 +00:00
|
|
|
|
public bool FilteringActive { get; set; }
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
protected SettingsSubsection()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Direction = FillDirection.Vertical;
|
|
|
|
|
|
|
|
|
|
FlowContent = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2020-11-30 08:43:53 +00:00
|
|
|
|
Spacing = new Vector2(0, 8),
|
2018-04-13 09:19:50 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
AddRangeInternal(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
2018-07-24 12:42:06 +00:00
|
|
|
|
Text = Header.ToUpperInvariant(),
|
2020-11-30 08:43:53 +00:00
|
|
|
|
Margin = new MarginPadding { Vertical = 30, Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS },
|
2020-03-16 23:32:25 +00:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
2018-04-13 09:19:50 +00:00
|
|
|
|
},
|
|
|
|
|
FlowContent
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|