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:
parent
9f4df29880
commit
1246f15186
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user