mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Move GetSettingUnderlyingValue
to a SettingSource
extension method
This commit is contained in:
@ -12,7 +12,6 @@ using osu.Framework.Logging;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Online.API
|
||||
{
|
||||
@ -43,7 +42,7 @@ namespace osu.Game.Online.API
|
||||
var bindable = (IBindable)property.GetValue(mod);
|
||||
|
||||
if (!bindable.IsDefault)
|
||||
Settings.Add(property.Name.Underscore(), ModUtils.GetSettingUnderlyingValue(bindable));
|
||||
Settings.Add(property.Name.Underscore(), bindable.GetUnderlyingSettingValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,13 +92,13 @@ namespace osu.Game.Online.API
|
||||
|
||||
public bool Equals(KeyValuePair<string, object> x, KeyValuePair<string, object> y)
|
||||
{
|
||||
object xValue = ModUtils.GetSettingUnderlyingValue(x.Value);
|
||||
object yValue = ModUtils.GetSettingUnderlyingValue(y.Value);
|
||||
object xValue = x.Value.GetUnderlyingSettingValue();
|
||||
object yValue = y.Value.GetUnderlyingSettingValue();
|
||||
|
||||
return x.Key == y.Key && EqualityComparer<object>.Default.Equals(xValue, yValue);
|
||||
}
|
||||
|
||||
public int GetHashCode(KeyValuePair<string, object> obj) => HashCode.Combine(obj.Key, ModUtils.GetSettingUnderlyingValue(obj.Value));
|
||||
public int GetHashCode(KeyValuePair<string, object> obj) => HashCode.Combine(obj.Key, obj.Value.GetUnderlyingSettingValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using MessagePack;
|
||||
using MessagePack.Formatters;
|
||||
using osu.Game.Utils;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Online.API
|
||||
{
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Online.API
|
||||
var stringBytes = new ReadOnlySequence<byte>(Encoding.UTF8.GetBytes(kvp.Key));
|
||||
writer.WriteString(in stringBytes);
|
||||
|
||||
primitiveFormatter.Serialize(ref writer, ModUtils.GetSettingUnderlyingValue(kvp.Value), options);
|
||||
primitiveFormatter.Serialize(ref writer, kvp.Value.GetUnderlyingSettingValue(), options);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user