Copy values using Bind to also copy defaults

This commit is contained in:
Dean Herbert 2021-01-03 20:44:57 +09:00
parent 6ad1b7767e
commit 2501707d7d
1 changed files with 11 additions and 1 deletions

View File

@ -150,7 +150,17 @@ public virtual Mod CreateCopy()
/// </summary>
/// <param name="bindable">The target bindable to apply the adjustment.</param>
/// <param name="value">The adjustment to apply.</param>
internal virtual void CopyAdjustedSetting(IBindable bindable, object value) => bindable.Parse(value);
internal virtual void CopyAdjustedSetting(IBindable bindable, object value)
{
if (value is IBindable incoming)
{
//copy including transfer of default values.
bindable.BindTo(incoming);
bindable.UnbindFrom(incoming);
}
else
bindable.Parse(value);
}
public bool Equals(IMod other) => GetType() == other?.GetType();
}