mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Mark key and value non-nullable (at realm end) and simplify Value
logic
This commit is contained in:
parent
a150fb2996
commit
a1d325cb22
@ -21,17 +21,12 @@ namespace osu.Game.Configuration
|
||||
[Indexed]
|
||||
public int Variant { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
[MapTo(nameof(Value))]
|
||||
public string ValueString { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Value { get; set; } = string.Empty;
|
||||
|
||||
public object Value
|
||||
{
|
||||
get => ValueString;
|
||||
set => ValueString = value.ToString();
|
||||
}
|
||||
|
||||
public override string ToString() => $"{Key}=>{Value}";
|
||||
public override string ToString() => $"{Key} => {Value}";
|
||||
}
|
||||
}
|
||||
|
@ -462,8 +462,8 @@ namespace osu.Game
|
||||
|
||||
usage.Realm.Add(new RealmRulesetSetting
|
||||
{
|
||||
ValueString = dkb.StringValue,
|
||||
Key = dkb.Key,
|
||||
Value = dkb.StringValue,
|
||||
RulesetID = dkb.RulesetID.Value,
|
||||
Variant = dkb.Variant ?? 0,
|
||||
});
|
||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Configuration
|
||||
setting = new RealmRulesetSetting
|
||||
{
|
||||
Key = lookup.ToString(),
|
||||
Value = bindable.Value,
|
||||
Value = bindable.Value.ToString(),
|
||||
RulesetID = rulesetId,
|
||||
Variant = variant,
|
||||
};
|
||||
@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.Configuration
|
||||
|
||||
bindable.ValueChanged += b =>
|
||||
{
|
||||
realmFactory?.Context.Write(() => setting.Value = b.NewValue);
|
||||
realmFactory?.Context.Write(() => setting.Value = b.NewValue.ToString());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user