1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 12:27:25 +08:00

Merge pull request #10100 from peppy/settings-group-title-fix

Move title specification for settings groups to constructor
This commit is contained in:
Dan Balasescu 2020-09-09 19:24:18 +09:00 committed by GitHub
commit e81de1ddbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 20 deletions

View File

@ -48,7 +48,10 @@ namespace osu.Game.Tests.Visual.Gameplay
private class ExampleContainer : PlayerSettingsGroup private class ExampleContainer : PlayerSettingsGroup
{ {
protected override string Title => @"example"; public ExampleContainer()
: base("example")
{
}
} }
} }
} }

View File

@ -20,8 +20,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
private const int padding = 10; private const int padding = 10;
protected override string Title => @"ladder";
private SettingsDropdown<TournamentRound> roundDropdown; private SettingsDropdown<TournamentRound> roundDropdown;
private PlayerCheckbox losersCheckbox; private PlayerCheckbox losersCheckbox;
private DateTextBox dateTimeBox; private DateTextBox dateTimeBox;
@ -34,6 +32,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
[Resolved] [Resolved]
private LadderInfo ladderInfo { get; set; } private LadderInfo ladderInfo { get; set; }
public LadderEditorSettings()
: base("ladder")
{
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {

View File

@ -8,9 +8,8 @@ namespace osu.Game.Rulesets.Edit
{ {
public class ToolboxGroup : PlayerSettingsGroup public class ToolboxGroup : PlayerSettingsGroup
{ {
protected override string Title => "toolbox";
public ToolboxGroup() public ToolboxGroup()
: base("toolbox")
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Width = 1; Width = 1;

View File

@ -10,7 +10,10 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
public class CollectionSettings : PlayerSettingsGroup public class CollectionSettings : PlayerSettingsGroup
{ {
protected override string Title => @"collections"; public CollectionSettings()
: base("collections")
{
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -10,7 +10,10 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
public class DiscussionSettings : PlayerSettingsGroup public class DiscussionSettings : PlayerSettingsGroup
{ {
protected override string Title => @"discussions"; public DiscussionSettings()
: base("discussions")
{
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)

View File

@ -9,11 +9,10 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
public class InputSettings : PlayerSettingsGroup public class InputSettings : PlayerSettingsGroup
{ {
protected override string Title => "Input settings";
private readonly PlayerCheckbox mouseButtonsCheckbox; private readonly PlayerCheckbox mouseButtonsCheckbox;
public InputSettings() public InputSettings()
: base("Input Settings")
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -13,8 +13,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
private const int padding = 10; private const int padding = 10;
protected override string Title => @"playback";
public readonly Bindable<double> UserPlaybackRate = new BindableDouble(1) public readonly Bindable<double> UserPlaybackRate = new BindableDouble(1)
{ {
Default = 1, Default = 1,
@ -28,6 +26,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
private readonly OsuSpriteText multiplierText; private readonly OsuSpriteText multiplierText;
public PlaybackSettings() public PlaybackSettings()
: base("playback")
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -17,11 +17,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
public abstract class PlayerSettingsGroup : Container public abstract class PlayerSettingsGroup : Container
{ {
/// <summary>
/// The title to be displayed in the header of this group.
/// </summary>
protected abstract string Title { get; }
private const float transition_duration = 250; private const float transition_duration = 250;
private const int container_width = 270; private const int container_width = 270;
private const int border_thickness = 2; private const int border_thickness = 2;
@ -58,7 +53,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
private Color4 expandedColour; private Color4 expandedColour;
protected PlayerSettingsGroup() /// <summary>
/// Create a new instance.
/// </summary>
/// <param name="title">The title to be displayed in the header of this group.</param>
protected PlayerSettingsGroup(string title)
{ {
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Width = container_width; Width = container_width;
@ -95,7 +94,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Text = Title.ToUpperInvariant(), Text = title.ToUpperInvariant(),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
Margin = new MarginPadding { Left = 10 }, Margin = new MarginPadding { Left = 10 },
}, },

View File

@ -10,8 +10,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
public class VisualSettings : PlayerSettingsGroup public class VisualSettings : PlayerSettingsGroup
{ {
protected override string Title => "Visual settings";
private readonly PlayerSliderBar<double> dimSliderBar; private readonly PlayerSliderBar<double> dimSliderBar;
private readonly PlayerSliderBar<double> blurSliderBar; private readonly PlayerSliderBar<double> blurSliderBar;
private readonly PlayerCheckbox showStoryboardToggle; private readonly PlayerCheckbox showStoryboardToggle;
@ -19,6 +17,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
private readonly PlayerCheckbox beatmapHitsoundsToggle; private readonly PlayerCheckbox beatmapHitsoundsToggle;
public VisualSettings() public VisualSettings()
: base("Visual Settings")
{ {
Children = new Drawable[] Children = new Drawable[]
{ {