/// <summary> /// Transfer a setting from <see cref="BeatmapDifficulty"/> to a configuration bindable. /// Only performs the transfer if the user is not currently overriding. /// </summary> protected void TransferSetting <T>(BindableNumber <T> bindable, T beatmapDefault) where T : struct, IComparable <T>, IConvertible, IEquatable <T> { bindable.UnbindEvents(); userChangedSettings.TryAdd(bindable, false); bindable.Default = beatmapDefault; // users generally choose a difficulty setting and want it to stick across multiple beatmap changes. // we only want to value transfer if the user hasn't changed the value previously. if (!userChangedSettings[bindable]) { bindable.Value = beatmapDefault; } bindable.ValueChanged += _ => userChangedSettings[bindable] = !bindable.IsDefault; }