mirror of
https://github.com/ppy/osu
synced 2025-01-08 23:29:43 +00:00
Merge pull request #13870 from bdach/fix-difficulty-bindable-bind-order
Fix reset to default logic failing for difficulty adjust mod
This commit is contained in:
commit
e70744ee37
@ -157,6 +157,23 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
checkBindableAtValue("Circle Size", 3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestResetToDefaults()
|
||||
{
|
||||
setBeatmapWithDifficultyParameters(5);
|
||||
|
||||
setSliderValue("Circle Size", 3);
|
||||
setExtendedLimits(true);
|
||||
|
||||
checkSliderAtValue("Circle Size", 3);
|
||||
checkBindableAtValue("Circle Size", 3);
|
||||
|
||||
AddStep("reset mod settings", () => modDifficultyAdjust.ResetSettingsToDefaults());
|
||||
|
||||
checkSliderAtValue("Circle Size", 5);
|
||||
checkBindableAtValue("Circle Size", null);
|
||||
}
|
||||
|
||||
private void resetToDefault(string name)
|
||||
{
|
||||
AddStep($"Reset {name} to default", () =>
|
||||
|
@ -104,15 +104,17 @@ namespace osu.Game.Rulesets.Mods
|
||||
if (!(them is DifficultyBindable otherDifficultyBindable))
|
||||
throw new InvalidOperationException($"Cannot bind to a non-{nameof(DifficultyBindable)}.");
|
||||
|
||||
base.BindTo(them);
|
||||
|
||||
CurrentNumber.BindTarget = otherDifficultyBindable.CurrentNumber;
|
||||
ExtendedLimits.BindTarget = otherDifficultyBindable.ExtendedLimits;
|
||||
ReadCurrentFromDifficulty = otherDifficultyBindable.ReadCurrentFromDifficulty;
|
||||
|
||||
// the following is only safe as long as these values are effectively constants.
|
||||
// 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;
|
||||
|
||||
// the actual values need to be copied after the max value constraints.
|
||||
CurrentNumber.BindTarget = otherDifficultyBindable.CurrentNumber;
|
||||
base.BindTo(them);
|
||||
}
|
||||
|
||||
public override void UnbindFrom(IUnbindable them)
|
||||
|
Loading…
Reference in New Issue
Block a user