mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge pull request #21541 from bdach/difficulty-bindable-regression
Fix extended values in difficulty adjust being truncated to 10 on beatmap change
This commit is contained in:
commit
70e0a04af8
@ -126,6 +126,21 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
checkBindableAtValue("Circle Size", 9);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExtendedLimitsRetainedAfterBoundCopyCreation()
|
||||
{
|
||||
setExtendedLimits(true);
|
||||
setSliderValue("Circle Size", 11);
|
||||
|
||||
checkSliderAtValue("Circle Size", 11);
|
||||
checkBindableAtValue("Circle Size", 11);
|
||||
|
||||
AddStep("create bound copy", () => _ = modDifficultyAdjust.CircleSize.GetBoundCopy());
|
||||
|
||||
checkSliderAtValue("Circle Size", 11);
|
||||
checkBindableAtValue("Circle Size", 11);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestResetToDefault()
|
||||
{
|
||||
|
@ -118,11 +118,18 @@ namespace osu.Game.Rulesets.Mods
|
||||
if (!(them is DifficultyBindable otherDifficultyBindable))
|
||||
throw new InvalidOperationException($"Cannot bind to a non-{nameof(DifficultyBindable)}.");
|
||||
|
||||
// ensure that MaxValue and ExtendedMaxValue are copied across first before continuing.
|
||||
// not doing so may cause the value of CurrentNumber to be truncated to 10.
|
||||
otherDifficultyBindable.CopyTo(this);
|
||||
|
||||
// set up mutual binding for ExtendedLimits to correctly set the upper bound of CurrentNumber.
|
||||
ExtendedLimits.BindTarget = otherDifficultyBindable.ExtendedLimits;
|
||||
|
||||
// the actual values need to be copied after the max value constraints.
|
||||
// set up mutual binding for CurrentNumber. this must happen after all of the above.
|
||||
CurrentNumber.BindTarget = otherDifficultyBindable.CurrentNumber;
|
||||
|
||||
// finish up the binding by setting up weak references via the base call.
|
||||
// unfortunately this will call `.CopyTo()` again, but fixing that is problematic and messy.
|
||||
base.BindTo(them);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user