Implement UnbindFrom()

This commit is contained in:
smoogipoo 2021-07-12 17:33:29 +09:00
parent 242982730f
commit 4b393209ec
1 changed files with 11 additions and 0 deletions

View File

@ -115,6 +115,17 @@ public override void BindTo(Bindable<float?> them)
ExtendedMaxValue = otherDifficultyBindable.extendedMaxValue;
}
public override void UnbindFrom(IUnbindable them)
{
if (!(them is DifficultyBindable otherDifficultyBindable))
throw new InvalidOperationException($"Cannot unbind from a non-{nameof(DifficultyBindable)}.");
base.UnbindFrom(them);
CurrentNumber.UnbindFrom(otherDifficultyBindable.CurrentNumber);
ExtendedLimits.UnbindFrom(otherDifficultyBindable.ExtendedLimits);
}
public new DifficultyBindable GetBoundCopy() => new DifficultyBindable { BindTarget = this };
}
}