mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 08:02:54 +08:00
Fix default settings not being serialised / state tracked correctly
This commit is contained in:
parent
7445814fc6
commit
778b8a9bf7
@ -66,10 +66,16 @@ namespace osu.Game.Extensions
|
||||
|
||||
foreach (var (_, property) in component.GetSettingsSourceProperties())
|
||||
{
|
||||
if (!info.Settings.TryGetValue(property.Name.ToSnakeCase(), out object? settingValue))
|
||||
continue;
|
||||
var bindable = ((IBindable)property.GetValue(component)!);
|
||||
|
||||
skinnable.CopyAdjustedSetting(((IBindable)property.GetValue(component)!), settingValue);
|
||||
if (!info.Settings.TryGetValue(property.Name.ToSnakeCase(), out object? settingValue))
|
||||
{
|
||||
// TODO: We probably want to restore default if not included in serialisation information.
|
||||
// This is not simple to do as SetDefault() is only found in the typed Bindable<T> interface right now.
|
||||
continue;
|
||||
}
|
||||
|
||||
skinnable.CopyAdjustedSetting(bindable, settingValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
var bindable = (IBindable)property.GetValue(component)!;
|
||||
|
||||
if (!bindable.IsDefault)
|
||||
Settings.Add(property.Name.ToSnakeCase(), bindable.GetUnderlyingSettingValue());
|
||||
Settings.Add(property.Name.ToSnakeCase(), bindable.GetUnderlyingSettingValue());
|
||||
}
|
||||
|
||||
if (component is Container<Drawable> container)
|
||||
|
Loading…
Reference in New Issue
Block a user