From e4fd3b65f4f10d06ad69b812bef7bb5a64419437 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Sep 2023 22:18:28 +0900 Subject: [PATCH] Avoid recreating `ModSettingChangeTracker` unless required --- osu.Game/Rulesets/UI/ModIcon.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 578db6dc5d..8c7c380a59 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -173,7 +173,7 @@ namespace osu.Game.Rulesets.UI if (value is Mod actualMod) { modSettingsChangeTracker = new ModSettingChangeTracker(new[] { actualMod }); - modSettingsChangeTracker.SettingChanged = _ => updateMod(actualMod); + modSettingsChangeTracker.SettingChanged = _ => updateExtendedInformation(); } modAcronym.Text = value.Acronym; @@ -193,10 +193,14 @@ namespace osu.Game.Rulesets.UI backgroundColour = colours.ForModType(value.Type); updateColour(); + updateExtendedInformation(); + } + + private void updateExtendedInformation() + { bool showExtended = showExtendedInformation && !string.IsNullOrEmpty(mod.ExtendedIconInformation); extendedContent.Alpha = showExtended ? 1 : 0; - extendedText.Text = mod.ExtendedIconInformation; }