1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:23:00 +08:00

fix style issues

This commit is contained in:
Liam DeVoe 2020-03-20 13:21:44 -04:00
parent 5a6d8f1932
commit 9dc8146811
2 changed files with 6 additions and 3 deletions

View File

@ -45,11 +45,11 @@ namespace osu.Game.Configuration
TooltipText = tooltipText;
}
public SettingSourceAttribute(string label, string description, string tooltipText) : this(label, description)
public SettingSourceAttribute(string label, string description, string tooltipText)
: this(label, description)
{
TooltipText = tooltipText;
}
}
public static class SettingSourceExtensions

View File

@ -60,25 +60,28 @@ namespace osu.Game.Rulesets.Mods
get
{
List<string> attributes = new List<string>();
foreach ((SettingSourceAttribute attr, System.Reflection.PropertyInfo property) in this.GetOrderedSettingsSourceProperties())
{
// use TooltipText from SettingSource if available, but fall back to Label, which has to be provided
string tooltipText = attr.TooltipText ?? attr.Label + " {0}";
object bindableObj = property.GetValue(this);
if (bindableObj is BindableInt bindableInt && !bindableInt.IsDefault)
{
attributes.Add(string.Format(tooltipText, bindableInt.Value));
continue;
}
if (bindableObj is BindableFloat bindableFloat && !bindableFloat.IsDefault)
{
attributes.Add(string.Format(tooltipText, bindableFloat.Value));
continue;
}
if (bindableObj is BindableDouble bindableDouble && !bindableDouble.IsDefault)
{
attributes.Add(string.Format(tooltipText, bindableDouble.Value));
continue;
}
}
return $"{Name}{(attributes.Any() ? $" ({string.Join(", ", attributes)})" : "")}";