mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Convert function weirdness to property + bool
This commit is contained in:
parent
5d0842ac44
commit
b41e273086
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
GetClassicDefault = () => false,
|
ClassicDefault = false,
|
||||||
LabelText = "Snaking out sliders",
|
LabelText = "Snaking out sliders",
|
||||||
Current = config.GetBindable<bool>(OsuRulesetSetting.SnakingOutSliders)
|
Current = config.GetBindable<bool>(OsuRulesetSetting.SnakingOutSliders)
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
GetClassicDefault = () => false,
|
ClassicDefault = false,
|
||||||
LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak,
|
LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak,
|
||||||
Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak)
|
Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak)
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
{
|
{
|
||||||
new SettingsEnumDropdown<ScoringMode>
|
new SettingsEnumDropdown<ScoringMode>
|
||||||
{
|
{
|
||||||
GetClassicDefault = () => ScoringMode.Classic,
|
ClassicDefault = ScoringMode.Classic,
|
||||||
LabelText = GameplaySettingsStrings.ScoreDisplayMode,
|
LabelText = GameplaySettingsStrings.ScoreDisplayMode,
|
||||||
Current = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode),
|
Current = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode),
|
||||||
Keywords = new[] { "scoring" }
|
Keywords = new[] { "scoring" }
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
GetClassicDefault = () => false,
|
ClassicDefault = false,
|
||||||
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
|
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
|
||||||
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||||
Keywords = new[] { "hp", "bar" }
|
Keywords = new[] { "hp", "bar" }
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
},
|
},
|
||||||
new SettingsSlider<double, TimeSlider>
|
new SettingsSlider<double, TimeSlider>
|
||||||
{
|
{
|
||||||
GetClassicDefault = () => 0,
|
ClassicDefault = 0,
|
||||||
LabelText = UserInterfaceStrings.HoldToConfirmActivationTime,
|
LabelText = UserInterfaceStrings.HoldToConfirmActivationTime,
|
||||||
Current = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay),
|
Current = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay),
|
||||||
Keywords = new[] { @"delay" },
|
Keywords = new[] { @"delay" },
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
GetClassicDefault = () => true,
|
ClassicDefault = true,
|
||||||
LabelText = UserInterfaceStrings.RightMouseScroll,
|
LabelText = UserInterfaceStrings.RightMouseScroll,
|
||||||
Current = config.GetBindable<bool>(OsuSetting.SongSelectRightMouseScroll),
|
Current = config.GetBindable<bool>(OsuSetting.SongSelectRightMouseScroll),
|
||||||
},
|
},
|
||||||
|
@ -107,10 +107,8 @@ namespace osu.Game.Overlays.Settings
|
|||||||
LabelText.ToString()
|
LabelText.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GetClassicDefault != null)
|
if (hasClassicDefault)
|
||||||
{
|
|
||||||
keywords.Add(CLASSIC_DEFAULT_SEARCH_TERM);
|
keywords.Add(CLASSIC_DEFAULT_SEARCH_TERM);
|
||||||
}
|
|
||||||
|
|
||||||
return keywords;
|
return keywords;
|
||||||
}
|
}
|
||||||
@ -126,20 +124,27 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
public event Action SettingChanged;
|
public event Action SettingChanged;
|
||||||
|
|
||||||
|
private T classicDefault;
|
||||||
|
private bool hasClassicDefault;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An action which when invoked will apply a classic default value to this setting.
|
/// A "classic" default value for this setting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<T> GetClassicDefault { get; set; }
|
public T ClassicDefault
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
classicDefault = value;
|
||||||
|
hasClassicDefault = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyClassicDefault(bool useClassicDefault)
|
public void ApplyClassicDefault(bool useClassicDefault)
|
||||||
{
|
{
|
||||||
if (GetClassicDefault != null)
|
if (hasClassicDefault && useClassicDefault)
|
||||||
{
|
Current.Value = classicDefault;
|
||||||
if (useClassicDefault)
|
else
|
||||||
Current.Value = GetClassicDefault();
|
Current.SetDefault();
|
||||||
else
|
|
||||||
Current.SetDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SettingsItem()
|
protected SettingsItem()
|
||||||
|
Loading…
Reference in New Issue
Block a user