1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 22:47:20 +08:00
osu-lazer/osu.Game/Overlays/Settings/SettingsSubsection.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
2.1 KiB
C#
Raw Normal View History

// 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 18:19:50 +09:00
2022-06-17 16:37:17 +09:00
#nullable disable
2018-11-20 16:51:59 +09:00
using osuTK;
2017-02-07 13:52:19 +09:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Game.Graphics;
2018-04-13 18:19:50 +09:00
namespace osu.Game.Overlays.Settings
2017-02-07 13:52:19 +09:00
{
public abstract partial class SettingsSubsection : FillFlowContainer, IFilterable
2017-02-07 13:52:19 +09:00
{
protected override Container<Drawable> Content => FlowContent;
2018-04-13 18:19:50 +09:00
protected readonly FillFlowContainer FlowContent;
2018-04-13 18:19:50 +09:00
protected abstract LocalisableString Header { get; }
2018-04-13 18:19:50 +09:00
public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Header };
2019-02-28 13:31:40 +09:00
2017-05-30 16:33:26 +09:00
public bool MatchingFilter
{
set => this.FadeTo(value ? 1 : 0);
}
2018-04-13 18:19:50 +09:00
2019-03-29 00:29:07 +09:00
public bool FilteringActive { get; set; }
protected SettingsSubsection()
2017-02-07 13:52:19 +09:00
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
2017-03-04 11:00:17 +01:00
Direction = FillDirection.Vertical;
2018-04-13 18:19:50 +09:00
FlowContent = new FillFlowContainer
{
Margin = new MarginPadding { Top = SettingsSection.ITEM_SPACING },
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, SettingsSection.ITEM_SPACING),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
};
}
2018-04-13 18:19:50 +09:00
private const int header_height = 43;
private const int header_font_size = 20;
[BackgroundDependencyLoader]
private void load()
{
2017-07-11 16:58:06 +03:00
AddRangeInternal(new Drawable[]
2017-02-07 13:52:19 +09:00
{
new OsuSpriteText
{
Text = Header,
Margin = new MarginPadding { Vertical = (header_height - header_font_size) * 0.5f, Horizontal = SettingsPanel.CONTENT_MARGINS },
Font = OsuFont.GetFont(size: header_font_size),
2017-02-07 13:52:19 +09:00
},
FlowContent
2017-02-07 13:52:19 +09:00
});
}
}
}