From 1246f151869a99a7d7f404cc6a3c80e522f98f82 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Sep 2023 19:21:10 +0900 Subject: [PATCH] Don't show extended information where it duplicates already visible information --- .../Online/Leaderboards/LeaderboardScoreTooltip.cs | 2 +- osu.Game/Rulesets/UI/ModIcon.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs b/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs index 0b2e401f57..48e6be1b17 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScoreTooltip.cs @@ -210,7 +210,7 @@ namespace osu.Game.Online.Leaderboards Spacing = new Vector2(2f, 0f), Children = new Drawable[] { - new ModIcon(mod, showTooltip: false).With(icon => + new ModIcon(mod, showTooltip: false, showExtendedInformation: false).With(icon => { icon.Origin = Anchor.CentreLeft; icon.Anchor = Anchor.CentreLeft; diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 6101efc436..f13ed0d89d 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -38,7 +38,9 @@ namespace osu.Game.Rulesets.UI public virtual LocalisableString TooltipText => showTooltip ? ((mod as Mod)?.IconTooltip ?? mod.Name) : null; private IMod mod; + private readonly bool showTooltip; + private readonly bool showExtendedInformation; public IMod Mod { @@ -73,13 +75,15 @@ namespace osu.Game.Rulesets.UI /// /// The mod to be displayed /// Whether a tooltip describing the mod should display on hover. - public ModIcon(IMod mod, bool showTooltip = true) + /// Whether to display a mod's extended information, if available. + public ModIcon(IMod mod, bool showTooltip = true, bool showExtendedInformation = true) { AutoSizeAxes = Axes.X; Height = size; this.mod = mod ?? throw new ArgumentNullException(nameof(mod)); this.showTooltip = showTooltip; + this.showExtendedInformation = showExtendedInformation; } [BackgroundDependencyLoader] @@ -187,9 +191,9 @@ namespace osu.Game.Rulesets.UI backgroundColour = colours.ForModType(value.Type); updateColour(); - bool hasExtended = !string.IsNullOrEmpty(mod.ExtendedIconInformation); + bool showExtended = showExtendedInformation && !string.IsNullOrEmpty(mod.ExtendedIconInformation); - extendedContent.Alpha = hasExtended ? 1 : 0; + extendedContent.Alpha = showExtended ? 1 : 0; extendedText.Text = mod.ExtendedIconInformation; }