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);