1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 11:27:24 +08:00
osu-lazer/osu.Game/Overlays/Settings/SettingsSubsection.cs

63 lines
1.9 KiB
C#
Raw Normal View History

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