1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:42:56 +08:00

Merge pull request #24632 from peppy/mod-bool-display-improvement

Show mod settings as "on" or "off" rather than "True" or "False"
This commit is contained in:
Bartłomiej Dach 2023-08-23 19:47:55 +02:00 committed by GitHub
commit 8d24bf5049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,8 +71,21 @@ namespace osu.Game.Rulesets.Mods
{
var bindable = (IBindable)property.GetValue(this)!;
string valueText;
switch (bindable)
{
case Bindable<bool> b:
valueText = b.Value ? "on" : "off";
break;
default:
valueText = bindable.ToString() ?? string.Empty;
break;
}
if (!bindable.IsDefault)
tooltipTexts.Add($"{attr.Label}: {bindable}");
tooltipTexts.Add($"{attr.Label}: {valueText}");
}
return string.Join(", ", tooltipTexts.Where(s => !string.IsNullOrEmpty(s)));