Move GetSettingUnderlyingValue to a SettingSource extension method

This commit is contained in:
Dean Herbert
2022-03-15 14:53:50 +09:00
parent 6d5692fcec
commit 1814a325d8
6 changed files with 47 additions and 50 deletions

View File

@ -192,7 +192,7 @@ namespace osu.Game.Rulesets.Mods
hashCode.Add(GetType());
foreach (var setting in Settings)
hashCode.Add(ModUtils.GetSettingUnderlyingValue(setting));
hashCode.Add(setting.GetUnderlyingSettingValue());
return hashCode.ToHashCode();
}
@ -208,13 +208,13 @@ namespace osu.Game.Rulesets.Mods
public bool Equals(IBindable x, IBindable y)
{
object xValue = x == null ? null : ModUtils.GetSettingUnderlyingValue(x);
object yValue = y == null ? null : ModUtils.GetSettingUnderlyingValue(y);
object xValue = x?.GetUnderlyingSettingValue();
object yValue = y?.GetUnderlyingSettingValue();
return EqualityComparer<object>.Default.Equals(xValue, yValue);
}
public int GetHashCode(IBindable obj) => ModUtils.GetSettingUnderlyingValue(obj).GetHashCode();
public int GetHashCode(IBindable obj) => obj.GetUnderlyingSettingValue().GetHashCode();
}
}
}