mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 02:37:25 +08:00
38a4c84163
Fixes header not being displayed with variant bindings. This follows what SettingsSection does.
63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
using OpenTK;
|
|
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;
|
|
|
|
namespace osu.Game.Overlays.Settings
|
|
{
|
|
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>();
|
|
public string[] FilterTerms => new[] { Header };
|
|
public bool MatchingFilter
|
|
{
|
|
set
|
|
{
|
|
this.FadeTo(value ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
protected SettingsSubsection()
|
|
{
|
|
RelativeSizeAxes = Axes.X;
|
|
AutoSizeAxes = Axes.Y;
|
|
Direction = FillDirection.Vertical;
|
|
|
|
FlowContent = new FillFlowContainer
|
|
{
|
|
Direction = FillDirection.Vertical,
|
|
Spacing = new Vector2(0, 5),
|
|
RelativeSizeAxes = Axes.X,
|
|
AutoSizeAxes = Axes.Y,
|
|
};
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
AddRangeInternal(new Drawable[]
|
|
{
|
|
new OsuSpriteText
|
|
{
|
|
Text = Header.ToUpper(),
|
|
Margin = new MarginPadding { Bottom = 10 },
|
|
Font = @"Exo2.0-Black",
|
|
},
|
|
FlowContent
|
|
});
|
|
}
|
|
}
|
|
}
|