From 4b393209ec2715fb57ce3750e8fab11e572cb8d1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 12 Jul 2021 17:33:29 +0900 Subject: [PATCH] Implement UnbindFrom() --- osu.Game/Rulesets/Mods/DifficultyBindable.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Rulesets/Mods/DifficultyBindable.cs b/osu.Game/Rulesets/Mods/DifficultyBindable.cs index cf86e9ad19..ff859de30b 100644 --- a/osu.Game/Rulesets/Mods/DifficultyBindable.cs +++ b/osu.Game/Rulesets/Mods/DifficultyBindable.cs @@ -115,6 +115,17 @@ public override void BindTo(Bindable 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 }; } }