From 2b73d816a70fab655cdf7a9f716d6630b333ed54 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 26 Feb 2024 21:26:35 +0300 Subject: [PATCH] Bring back mod setting tracker in `BeatmapAttributesDisplay` --- osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs | 12 +++++++++++- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 7 +------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs b/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs index 7035af1594..c58cf710bd 100644 --- a/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs +++ b/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs @@ -13,6 +13,7 @@ using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -43,6 +44,8 @@ namespace osu.Game.Overlays.Mods public BindableBool Collapsed { get; } = new BindableBool(true); + private ModSettingChangeTracker? modSettingChangeTracker; + [Resolved] private BeatmapDifficultyCache difficultyCache { get; set; } = null!; @@ -97,7 +100,14 @@ namespace osu.Game.Overlays.Mods { base.LoadComplete(); - Mods.BindValueChanged(_ => updateValues()); + Mods.BindValueChanged(_ => + { + modSettingChangeTracker?.Dispose(); + modSettingChangeTracker = new ModSettingChangeTracker(Mods.Value); + modSettingChangeTracker.SettingChanged += _ => updateValues(); + updateValues(); + }, true); + BeatmapInfo.BindValueChanged(_ => updateValues()); Collapsed.BindValueChanged(_ => diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index bf43dc3d9c..b7e2f744fa 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -468,12 +468,7 @@ namespace osu.Game.Overlays.Mods } if (beatmapAttributesDisplay != null) - { - if (!ReferenceEquals(beatmapAttributesDisplay.Mods.Value, mods)) - beatmapAttributesDisplay.Mods.Value = mods; - else - beatmapAttributesDisplay.Mods.TriggerChange(); // mods list may be same but a mod setting has changed, trigger change in that case. - } + beatmapAttributesDisplay.Mods.Value = mods; } private void updateCustomisation()