From fd2bdc10c7d1106e01552f48018f9e80622c6e76 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Jul 2023 18:52:19 +0900 Subject: [PATCH 1/3] Fix "key count" setting showing as "circle size" in osu!mania editor Closes https://github.com/ppy/osu/issues/12904. --- .../Edit/Setup/ManiaDifficultySection.cs | 19 ++++++++++ osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 + osu.Game/Rulesets/Ruleset.cs | 5 +++ .../Screens/Edit/Setup/DifficultySection.cs | 38 +++++++++---------- osu.Game/Screens/Edit/Setup/SetupScreen.cs | 6 ++- 5 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs new file mode 100644 index 0000000000..82ec66a28a --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Game.Resources.Localisation.Web; +using osu.Game.Screens.Edit.Setup; + +namespace osu.Game.Rulesets.Mania.Edit.Setup +{ + public partial class ManiaDifficultySection : DifficultySection + { + [BackgroundDependencyLoader] + private void load() + { + CircleSizeSlider.Label = BeatmapsetsStrings.ShowStatsCsMania; + CircleSizeSlider.Description = "The number of columns in the beatmap"; + } + } +} diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 802399e247..4507015169 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -425,6 +425,8 @@ namespace osu.Game.Rulesets.Mania } public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection(); + + public override DifficultySection CreateEditorDifficultySection() => new ManiaDifficultySection(); } public enum PlayfieldType diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index cd432e050b..be0d757e06 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -384,5 +384,10 @@ namespace osu.Game.Rulesets /// Can be overridden to add a ruleset-specific section to the editor beatmap setup screen. /// public virtual RulesetSetupSection? CreateEditorSetupSection() => null; + + /// + /// Can be overridden to alter the difficulty section to the editor beatmap setup screen. + /// + public virtual DifficultySection? CreateEditorDifficultySection() => null; } } diff --git a/osu.Game/Screens/Edit/Setup/DifficultySection.cs b/osu.Game/Screens/Edit/Setup/DifficultySection.cs index 4c062b0cb7..3954271290 100644 --- a/osu.Game/Screens/Edit/Setup/DifficultySection.cs +++ b/osu.Game/Screens/Edit/Setup/DifficultySection.cs @@ -13,14 +13,14 @@ using osu.Game.Localisation; namespace osu.Game.Screens.Edit.Setup { - internal partial class DifficultySection : SetupSection + public partial class DifficultySection : SetupSection { - private LabelledSliderBar circleSizeSlider = null!; - private LabelledSliderBar healthDrainSlider = null!; - private LabelledSliderBar approachRateSlider = null!; - private LabelledSliderBar overallDifficultySlider = null!; - private LabelledSliderBar baseVelocitySlider = null!; - private LabelledSliderBar tickRateSlider = null!; + protected LabelledSliderBar CircleSizeSlider = null!; + protected LabelledSliderBar HealthDrainSlider = null!; + protected LabelledSliderBar ApproachRateSlider = null!; + protected LabelledSliderBar OverallDifficultySlider = null!; + protected LabelledSliderBar BaseVelocitySlider = null!; + protected LabelledSliderBar TickRateSlider = null!; public override LocalisableString Title => EditorSetupStrings.DifficultyHeader; @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Edit.Setup { Children = new Drawable[] { - circleSizeSlider = new LabelledSliderBar + CircleSizeSlider = new LabelledSliderBar { Label = BeatmapsetsStrings.ShowStatsCs, FixedLabelWidth = LABEL_WIDTH, @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Edit.Setup Precision = 0.1f, } }, - healthDrainSlider = new LabelledSliderBar + HealthDrainSlider = new LabelledSliderBar { Label = BeatmapsetsStrings.ShowStatsDrain, FixedLabelWidth = LABEL_WIDTH, @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit.Setup Precision = 0.1f, } }, - approachRateSlider = new LabelledSliderBar + ApproachRateSlider = new LabelledSliderBar { Label = BeatmapsetsStrings.ShowStatsAr, FixedLabelWidth = LABEL_WIDTH, @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Edit.Setup Precision = 0.1f, } }, - overallDifficultySlider = new LabelledSliderBar + OverallDifficultySlider = new LabelledSliderBar { Label = BeatmapsetsStrings.ShowStatsAccuracy, FixedLabelWidth = LABEL_WIDTH, @@ -81,7 +81,7 @@ namespace osu.Game.Screens.Edit.Setup Precision = 0.1f, } }, - baseVelocitySlider = new LabelledSliderBar + BaseVelocitySlider = new LabelledSliderBar { Label = EditorSetupStrings.BaseVelocity, FixedLabelWidth = LABEL_WIDTH, @@ -94,7 +94,7 @@ namespace osu.Game.Screens.Edit.Setup Precision = 0.01f, } }, - tickRateSlider = new LabelledSliderBar + TickRateSlider = new LabelledSliderBar { Label = EditorSetupStrings.TickRate, FixedLabelWidth = LABEL_WIDTH, @@ -120,12 +120,12 @@ namespace osu.Game.Screens.Edit.Setup { // for now, update these on commit rather than making BeatmapMetadata bindables. // after switching database engines we can reconsider if switching to bindables is a good direction. - Beatmap.Difficulty.CircleSize = circleSizeSlider.Current.Value; - Beatmap.Difficulty.DrainRate = healthDrainSlider.Current.Value; - Beatmap.Difficulty.ApproachRate = approachRateSlider.Current.Value; - Beatmap.Difficulty.OverallDifficulty = overallDifficultySlider.Current.Value; - Beatmap.Difficulty.SliderMultiplier = baseVelocitySlider.Current.Value; - Beatmap.Difficulty.SliderTickRate = tickRateSlider.Current.Value; + Beatmap.Difficulty.CircleSize = CircleSizeSlider.Current.Value; + Beatmap.Difficulty.DrainRate = HealthDrainSlider.Current.Value; + Beatmap.Difficulty.ApproachRate = ApproachRateSlider.Current.Value; + Beatmap.Difficulty.OverallDifficulty = OverallDifficultySlider.Current.Value; + Beatmap.Difficulty.SliderMultiplier = BaseVelocitySlider.Current.Value; + Beatmap.Difficulty.SliderTickRate = TickRateSlider.Current.Value; Beatmap.UpdateAllHitObjects(); Beatmap.SaveState(); diff --git a/osu.Game/Screens/Edit/Setup/SetupScreen.cs b/osu.Game/Screens/Edit/Setup/SetupScreen.cs index ab4299a2f0..266ea1f929 100644 --- a/osu.Game/Screens/Edit/Setup/SetupScreen.cs +++ b/osu.Game/Screens/Edit/Setup/SetupScreen.cs @@ -26,16 +26,18 @@ namespace osu.Game.Screens.Edit.Setup [BackgroundDependencyLoader] private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider) { + var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance(); + var sectionsEnumerable = new List { new ResourcesSection(), new MetadataSection(), - new DifficultySection(), + ruleset.CreateEditorDifficultySection() ?? new DifficultySection(), new ColoursSection(), new DesignSection(), }; - var rulesetSpecificSection = beatmap.BeatmapInfo.Ruleset.CreateInstance().CreateEditorSetupSection(); + var rulesetSpecificSection = ruleset.CreateEditorSetupSection(); if (rulesetSpecificSection != null) sectionsEnumerable.Add(rulesetSpecificSection); From f985bdc10f5e5f26f3fb3011030d99cae6fb1926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 22 Jul 2023 15:55:20 +0200 Subject: [PATCH 2/3] Make difficulty sliders `private set` --- osu.Game/Screens/Edit/Setup/DifficultySection.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/DifficultySection.cs b/osu.Game/Screens/Edit/Setup/DifficultySection.cs index 3954271290..1915b0cfd1 100644 --- a/osu.Game/Screens/Edit/Setup/DifficultySection.cs +++ b/osu.Game/Screens/Edit/Setup/DifficultySection.cs @@ -15,12 +15,12 @@ namespace osu.Game.Screens.Edit.Setup { public partial class DifficultySection : SetupSection { - protected LabelledSliderBar CircleSizeSlider = null!; - protected LabelledSliderBar HealthDrainSlider = null!; - protected LabelledSliderBar ApproachRateSlider = null!; - protected LabelledSliderBar OverallDifficultySlider = null!; - protected LabelledSliderBar BaseVelocitySlider = null!; - protected LabelledSliderBar TickRateSlider = null!; + protected LabelledSliderBar CircleSizeSlider { get; private set; } = null!; + protected LabelledSliderBar HealthDrainSlider { get; private set; } = null!; + protected LabelledSliderBar ApproachRateSlider { get; private set; } = null!; + protected LabelledSliderBar OverallDifficultySlider { get; private set; } = null!; + protected LabelledSliderBar BaseVelocitySlider { get; private set; } = null!; + protected LabelledSliderBar TickRateSlider { get; private set; } = null!; public override LocalisableString Title => EditorSetupStrings.DifficultyHeader; From 157aec5144e5030486193821f18335cc329c3637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 22 Jul 2023 16:10:58 +0200 Subject: [PATCH 3/3] Fix mania key count slider still using circle size precision --- osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs index 82ec66a28a..4f983debea 100644 --- a/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs +++ b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.Edit.Setup; @@ -14,6 +15,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Setup { CircleSizeSlider.Label = BeatmapsetsStrings.ShowStatsCsMania; CircleSizeSlider.Description = "The number of columns in the beatmap"; + if (CircleSizeSlider.Current is BindableNumber circleSizeFloat) + circleSizeFloat.Precision = 1; } } }