diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs b/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs index 947edb5dd9..80b5244c34 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs @@ -18,6 +18,8 @@ namespace osu.Game.Rulesets.Catch.Mods Precision = 0.1f, MinValue = 1, MaxValue = 10, + ExtendedMaxValue = 11, + ReadFromDifficulty = diff => diff.CircleSize, }; [SettingSource("Approach Rate", "Override a beatmap's set AR.", LAST_SETTING_ORDER + 1)] @@ -26,6 +28,8 @@ namespace osu.Game.Rulesets.Catch.Mods Precision = 0.1f, MinValue = 1, MaxValue = 10, + ExtendedMaxValue = 11, + ReadFromDifficulty = diff => diff.ApproachRate, }; [SettingSource("Spicy Patterns", "Adjust the patterns as if Hard Rock is enabled.")] diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs index 403ec2c33d..d93b097663 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs @@ -17,15 +17,17 @@ namespace osu.Game.Rulesets.Osu.Mods MinValue = 0, MaxValue = 10, ExtendedMaxValue = 11, + ReadFromDifficulty = diff => diff.CircleSize, }; - [SettingSource("Approach Rate", "Override a beatmap's set AR.", LAST_SETTING_ORDER + 1, SettingControlType = typeof(ApproachRateSettingsControl))] + [SettingSource("Approach Rate", "Override a beatmap's set AR.", LAST_SETTING_ORDER + 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))] public DifficultyBindable ApproachRate { get; } = new DifficultyBindable { Precision = 0.1f, MinValue = 0, MaxValue = 10, ExtendedMaxValue = 11, + ReadFromDifficulty = diff => diff.ApproachRate, }; public OsuModDifficultyAdjust() diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs index 110a7eebc8..ace105b21c 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Taiko.Mods Precision = 0.05f, MinValue = 0.25f, MaxValue = 4, + ReadFromDifficulty = _ => 1, }; public override string SettingDescription diff --git a/osu.Game/Rulesets/Mods/ApproachRateSettingsControl.cs b/osu.Game/Rulesets/Mods/ApproachRateSettingsControl.cs deleted file mode 100644 index 18773afb30..0000000000 --- a/osu.Game/Rulesets/Mods/ApproachRateSettingsControl.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Beatmaps; - -namespace osu.Game.Rulesets.Mods -{ - public class ApproachRateSettingsControl : DifficultyAdjustSettingsControl - { - protected override float UpdateFromDifficulty(BeatmapDifficulty difficulty) => difficulty.ApproachRate; - } -} diff --git a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs index 1aede3425a..ef2b88846a 100644 --- a/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs +++ b/osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs @@ -11,7 +11,6 @@ using osu.Game.Overlays.Settings; namespace osu.Game.Rulesets.Mods { - // TODO: make abstract once we finish making each implementation. public class DifficultyAdjustSettingsControl : SettingsItem { [Resolved] @@ -69,14 +68,11 @@ namespace osu.Game.Rulesets.Mods if (Current.Value == null) { isInternalChange = true; - CurrentNumber.Value = UpdateFromDifficulty(difficulty); + CurrentNumber.Value = difficultyBindable.ReadFromDifficulty(difficulty); isInternalChange = false; } } - // TODO: make abstract - protected virtual float UpdateFromDifficulty(BeatmapDifficulty difficulty) => 0; - private class ControlDrawable : CompositeDrawable, IHasCurrentValue { private readonly BindableWithCurrent current = new BindableWithCurrent(); diff --git a/osu.Game/Rulesets/Mods/DifficultyBindable.cs b/osu.Game/Rulesets/Mods/DifficultyBindable.cs index d721154392..7b01b1e0c7 100644 --- a/osu.Game/Rulesets/Mods/DifficultyBindable.cs +++ b/osu.Game/Rulesets/Mods/DifficultyBindable.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Bindables; +using osu.Game.Beatmaps; namespace osu.Game.Rulesets.Mods { @@ -23,6 +24,11 @@ namespace osu.Game.Rulesets.Mods MaxValue = 10, }; + /// + /// A function that can extract the current value of this setting from a beatmap difficulty for display purposes. + /// + public Func ReadFromDifficulty; + public float Precision { set => CurrentNumber.Precision = value; diff --git a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs index d636f22dea..06bf7d9a6b 100644 --- a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs @@ -39,6 +39,7 @@ namespace osu.Game.Rulesets.Mods MinValue = 0, MaxValue = 10, ExtendedMaxValue = 11, + ReadFromDifficulty = diff => diff.DrainRate, }; [SettingSource("Accuracy", "Override a beatmap's set OD.", LAST_SETTING_ORDER, SettingControlType = typeof(DifficultyAdjustSettingsControl))] @@ -48,6 +49,7 @@ namespace osu.Game.Rulesets.Mods MinValue = 0, MaxValue = 10, ExtendedMaxValue = 11, + ReadFromDifficulty = diff => diff.OverallDifficulty, }; [SettingSource("Extended Limits", "Adjust difficulty beyond sane limits.")]