mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 10:27:26 +09:00
Simplify string construction logic
This commit is contained in:
parent
a6b153673e
commit
205f4dcb54
@ -60,8 +60,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string settingDescription = string.IsNullOrEmpty(SettingDescription) ? string.Empty : $" ({SettingDescription})";
|
string description = SettingDescription;
|
||||||
return $"{Name}{settingDescription}";
|
|
||||||
|
return string.IsNullOrEmpty(description) ? Name : $"{Name} ({description})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,13 +82,14 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
foreach ((SettingSourceAttribute attr, PropertyInfo property) in this.GetOrderedSettingsSourceProperties())
|
foreach ((SettingSourceAttribute attr, PropertyInfo property) in this.GetOrderedSettingsSourceProperties())
|
||||||
{
|
{
|
||||||
object bindableObj = property.GetValue(this);
|
object bindableObj = property.GetValue(this);
|
||||||
bool? settingIsDefault = (bindableObj as IHasDefaultValue)?.IsDefault;
|
|
||||||
string tooltipText = settingIsDefault == true ? string.Empty : attr.Label + " " + bindableObj;
|
if ((bindableObj as IHasDefaultValue)?.IsDefault == true)
|
||||||
tooltipTexts.Add(tooltipText);
|
continue;
|
||||||
|
|
||||||
|
tooltipTexts.Add($"{attr.Label} {bindableObj}");
|
||||||
}
|
}
|
||||||
|
|
||||||
string joinedTooltipText = string.Join(", ", tooltipTexts.Where(s => !string.IsNullOrEmpty(s)));
|
return string.Join(", ", tooltipTexts.Where(s => !string.IsNullOrEmpty(s)));
|
||||||
return $"{joinedTooltipText}";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user