mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 19:32:55 +08:00
Simplify some default value checks (we are sure the return is an IBindable)
This commit is contained in:
parent
1a44338124
commit
23e216fa0b
@ -31,7 +31,12 @@ namespace osu.Game.Online.API
|
|||||||
Acronym = mod.Acronym;
|
Acronym = mod.Acronym;
|
||||||
|
|
||||||
foreach (var (_, property) in mod.GetSettingsSourceProperties())
|
foreach (var (_, property) in mod.GetSettingsSourceProperties())
|
||||||
Settings.Add(property.Name.Underscore(), property.GetValue(mod));
|
{
|
||||||
|
var bindable = (IBindable)property.GetValue(mod);
|
||||||
|
|
||||||
|
if (!bindable.IsDefault)
|
||||||
|
Settings.Add(property.Name.Underscore(), property.GetValue(mod));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mod ToMod(Ruleset ruleset)
|
public Mod ToMod(Ruleset ruleset)
|
||||||
|
@ -84,12 +84,10 @@ 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);
|
var bindable = (IBindable)property.GetValue(this);
|
||||||
|
|
||||||
if ((bindableObj as IHasDefaultValue)?.IsDefault == true)
|
if (!bindable.IsDefault)
|
||||||
continue;
|
tooltipTexts.Add($"{attr.Label} {bindable}");
|
||||||
|
|
||||||
tooltipTexts.Add($"{attr.Label} {bindableObj}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Join(", ", tooltipTexts.Where(s => !string.IsNullOrEmpty(s)));
|
return string.Join(", ", tooltipTexts.Where(s => !string.IsNullOrEmpty(s)));
|
||||||
|
Loading…
Reference in New Issue
Block a user