mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Update DifficultyBindable
to match new bindable spec
This commit is contained in:
@ -99,22 +99,31 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
CurrentNumber.MaxValue = ExtendedLimits.Value && extendedMaxValue != null ? extendedMaxValue.Value : maxValue;
|
CurrentNumber.MaxValue = ExtendedLimits.Value && extendedMaxValue != null ? extendedMaxValue.Value : maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void CopyTo(Bindable<float?> them)
|
||||||
|
{
|
||||||
|
if (!(them is DifficultyBindable otherDifficultyBindable))
|
||||||
|
throw new InvalidOperationException($"Cannot copy to a non-{nameof(DifficultyBindable)}.");
|
||||||
|
|
||||||
|
base.CopyTo(them);
|
||||||
|
|
||||||
|
otherDifficultyBindable.ReadCurrentFromDifficulty = ReadCurrentFromDifficulty;
|
||||||
|
|
||||||
|
// the following max value copies are only safe as long as these values are effectively constants.
|
||||||
|
otherDifficultyBindable.MaxValue = maxValue;
|
||||||
|
otherDifficultyBindable.ExtendedMaxValue = extendedMaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
public override void BindTo(Bindable<float?> them)
|
public override void BindTo(Bindable<float?> them)
|
||||||
{
|
{
|
||||||
if (!(them is DifficultyBindable otherDifficultyBindable))
|
if (!(them is DifficultyBindable otherDifficultyBindable))
|
||||||
throw new InvalidOperationException($"Cannot bind to a non-{nameof(DifficultyBindable)}.");
|
throw new InvalidOperationException($"Cannot bind to a non-{nameof(DifficultyBindable)}.");
|
||||||
|
|
||||||
ReadCurrentFromDifficulty = otherDifficultyBindable.ReadCurrentFromDifficulty;
|
base.BindTo(them);
|
||||||
|
|
||||||
// the following max value copies are only safe as long as these values are effectively constants.
|
|
||||||
MaxValue = otherDifficultyBindable.maxValue;
|
|
||||||
ExtendedMaxValue = otherDifficultyBindable.extendedMaxValue;
|
|
||||||
|
|
||||||
ExtendedLimits.BindTarget = otherDifficultyBindable.ExtendedLimits;
|
ExtendedLimits.BindTarget = otherDifficultyBindable.ExtendedLimits;
|
||||||
|
|
||||||
// the actual values need to be copied after the max value constraints.
|
// the actual values need to be copied after the max value constraints.
|
||||||
CurrentNumber.BindTarget = otherDifficultyBindable.CurrentNumber;
|
CurrentNumber.BindTarget = otherDifficultyBindable.CurrentNumber;
|
||||||
base.BindTo(them);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UnbindFrom(IUnbindable them)
|
public override void UnbindFrom(IUnbindable them)
|
||||||
|
Reference in New Issue
Block a user