1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Don't show extended information where it duplicates already visible information

This commit is contained in:
Dean Herbert 2023-09-27 19:21:10 +09:00
parent 9f4df29880
commit 1246f15186
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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
/// </summary>
/// <param name="mod">The mod to be displayed</param>
/// <param name="showTooltip">Whether a tooltip describing the mod should display on hover.</param>
public ModIcon(IMod mod, bool showTooltip = true)
/// <param name="showExtendedInformation">Whether to display a mod's extended information, if available.</param>
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;
}