1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +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; 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; TooltipText = tooltipText;
} }
} }
public static class SettingSourceExtensions public static class SettingSourceExtensions

View File

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