Skip to content

Commit

Permalink
Merge pull request #30114 from bdach/form-slider-bar-transfer-value-o…
Browse files Browse the repository at this point in the history
…n-commit

Fix difficulty settings sliders attempting to reprocess all hitobjects on every instantaneous change
  • Loading branch information
peppy authored Oct 7, 2024
2 parents b977a18 + 1854e1c commit af43b36
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 47 deletions.
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.1006.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.1007.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Expand Down
5 changes: 5 additions & 0 deletions osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private void load()
MaxValue = 10,
Precision = 1,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
specialStyle = new FormCheckBox
Expand All @@ -67,6 +68,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
overallDifficultySlider = new FormSliderBar<float>
Expand All @@ -80,6 +82,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
baseVelocitySlider = new FormSliderBar<double>
Expand All @@ -93,6 +96,7 @@ private void load()
MaxValue = 3.6,
Precision = 0.01f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
tickRateSlider = new FormSliderBar<double>
Expand All @@ -106,6 +110,7 @@ private void load()
MaxValue = 4,
Precision = 1,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
};
Expand Down
7 changes: 7 additions & 0 deletions osu.Game.Rulesets.Osu/Edit/Setup/OsuDifficultySection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
healthDrainSlider = new FormSliderBar<float>
Expand All @@ -55,6 +56,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
approachRateSlider = new FormSliderBar<float>
Expand All @@ -68,6 +70,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
overallDifficultySlider = new FormSliderBar<float>
Expand All @@ -81,6 +84,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
baseVelocitySlider = new FormSliderBar<double>
Expand All @@ -94,6 +98,7 @@ private void load()
MaxValue = 3.6,
Precision = 0.01f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
tickRateSlider = new FormSliderBar<double>
Expand All @@ -107,6 +112,7 @@ private void load()
MaxValue = 4,
Precision = 1,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
stackLeniency = new FormSliderBar<float>
Expand All @@ -120,6 +126,7 @@ private void load()
MaxValue = 1,
Precision = 0.1f
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
};
Expand Down
4 changes: 4 additions & 0 deletions osu.Game.Rulesets.Taiko/Edit/Setup/TaikoDifficultySection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
overallDifficultySlider = new FormSliderBar<float>
Expand All @@ -52,6 +53,7 @@ private void load()
MaxValue = 10,
Precision = 0.1f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
baseVelocitySlider = new FormSliderBar<double>
Expand All @@ -65,6 +67,7 @@ private void load()
MaxValue = 3.6,
Precision = 0.01f,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
tickRateSlider = new FormSliderBar<double>
Expand All @@ -78,6 +81,7 @@ private void load()
MaxValue = 4,
Precision = 1,
},
TransferValueOnCommit = true,
TabbableContentContainer = this,
},
};
Expand Down
15 changes: 1 addition & 14 deletions osu.Game.Tests/Visual/UserInterface/TestSceneFormControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public TestSceneFormControls()
},
new FormSliderBar<float>
{
Caption = "Instantaneous slider",
Caption = "Slider",
Current = new BindableFloat
{
MinValue = 0,
Expand All @@ -82,19 +82,6 @@ public TestSceneFormControls()
},
TabbableContentContainer = this,
},
new FormSliderBar<float>
{
Caption = "Non-instantaneous slider",
Current = new BindableFloat
{
MinValue = 0,
MaxValue = 10,
Value = 5,
Precision = 0.1f,
},
Instantaneous = false,
TabbableContentContainer = this,
},
new FormEnumDropdown<CountdownType>
{
Caption = EditorSetupStrings.EnableCountdown,
Expand Down
63 changes: 63 additions & 0 deletions osu.Game.Tests/Visual/UserInterface/TestSceneFormSliderBar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osuTK;

namespace osu.Game.Tests.Visual.UserInterface
{
public partial class TestSceneFormSliderBar : OsuTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);

[Test]
public void TestTransferValueOnCommit()
{
OsuSpriteText text;
FormSliderBar<float> slider = null!;

AddStep("create content", () =>
{
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 0.5f,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
Children = new Drawable[]
{
text = new OsuSpriteText(),
slider = new FormSliderBar<float>
{
Caption = "Slider",
Current = new BindableFloat
{
MinValue = 0,
MaxValue = 10,
Precision = 0.1f,
Default = 5f,
}
},
}
};
slider.Current.BindValueChanged(_ => text.Text = $"Current value is: {slider.Current.Value}", true);
});
AddToggleStep("toggle transfer value on commit", b =>
{
if (slider.IsNotNull())
slider.TransferValueOnCommit = b;
});
}
}
}
Loading

0 comments on commit af43b36

Please sign in to comment.