1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 10:43:04 +08:00

Fix default settings not being serialised / state tracked correctly

This commit is contained in:
Dean Herbert 2023-02-06 15:00:42 +09:00
parent 7445814fc6
commit 778b8a9bf7
2 changed files with 10 additions and 5 deletions

View File

@ -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);
}
}

View File

@ -69,7 +69,6 @@ namespace osu.Game.Screens.Play.HUD
{
var bindable = (IBindable)property.GetValue(component)!;
if (!bindable.IsDefault)
Settings.Add(property.Name.ToSnakeCase(), bindable.GetUnderlyingSettingValue());
}