From 88b00123f6efe28c876d954b3a6957ad6febf2b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Jul 2021 17:00:55 +0900 Subject: [PATCH] Use existing reflection methods to avoid manual binding of `ExtendedLimits` --- osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs | 6 ------ osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs | 6 ------ osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs | 7 +++++-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs b/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs index 80b5244c34..8686627c2a 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModDifficultyAdjust.cs @@ -35,12 +35,6 @@ public class CatchModDifficultyAdjust : ModDifficultyAdjust, IApplicableToBeatma [SettingSource("Spicy Patterns", "Adjust the patterns as if Hard Rock is enabled.")] public BindableBool HardRockOffsets { get; } = new BindableBool(); - public CatchModDifficultyAdjust() - { - CircleSize.ExtendedLimits.BindTo(ExtendedLimits); - ApproachRate.ExtendedLimits.BindTo(ExtendedLimits); - } - public override string SettingDescription { get diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs index d93b097663..983216dfa1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs @@ -30,12 +30,6 @@ public class OsuModDifficultyAdjust : ModDifficultyAdjust ReadFromDifficulty = diff => diff.ApproachRate, }; - public OsuModDifficultyAdjust() - { - CircleSize.ExtendedLimits.BindTo(ExtendedLimits); - ApproachRate.ExtendedLimits.BindTo(ExtendedLimits); - } - public override string SettingDescription { get diff --git a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs index 06bf7d9a6b..d9d305d457 100644 --- a/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs +++ b/osu.Game/Rulesets/Mods/ModDifficultyAdjust.cs @@ -57,8 +57,11 @@ public abstract class ModDifficultyAdjust : Mod, IApplicableToDifficulty protected ModDifficultyAdjust() { - OverallDifficulty.ExtendedLimits.BindTo(ExtendedLimits); - DrainRate.ExtendedLimits.BindTo(ExtendedLimits); + foreach (var (_, property) in this.GetOrderedSettingsSourceProperties()) + { + if (property.GetValue(this) is DifficultyBindable diffAdjustBindable) + diffAdjustBindable.ExtendedLimits.BindTo(ExtendedLimits); + } } public override string SettingDescription