mirror of
https://github.com/ppy/osu
synced 2025-01-03 21:02:22 +00:00
Avoid tooltip display
This commit is contained in:
parent
b036f0165a
commit
a5f3418e56
@ -50,7 +50,7 @@ namespace osu.Game.Tournament.Components
|
||||
if (modIcon == null)
|
||||
return;
|
||||
|
||||
AddInternal(new ModIcon(modIcon)
|
||||
AddInternal(new ModIcon(modIcon, false)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -236,13 +236,13 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
iconsContainer.AddRange(new[]
|
||||
{
|
||||
backgroundIcon = new PassThroughTooltipModIcon(Mods[1])
|
||||
backgroundIcon = new ModIcon(Mods[1], false)
|
||||
{
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
Position = new Vector2(1.5f),
|
||||
},
|
||||
foregroundIcon = new PassThroughTooltipModIcon(Mods[0])
|
||||
foregroundIcon = new ModIcon(Mods[0], false)
|
||||
{
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
@ -252,7 +252,7 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
else
|
||||
{
|
||||
iconsContainer.Add(foregroundIcon = new PassThroughTooltipModIcon(Mod)
|
||||
iconsContainer.Add(foregroundIcon = new ModIcon(Mod, false)
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
@ -297,15 +297,5 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
Mod = mod;
|
||||
}
|
||||
|
||||
private class PassThroughTooltipModIcon : ModIcon
|
||||
{
|
||||
public override string TooltipText => null;
|
||||
|
||||
public PassThroughTooltipModIcon(Mod mod)
|
||||
: base(mod)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ using osu.Framework.Bindables;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Display the specified mod at a fixed size.
|
||||
/// </summary>
|
||||
public class ModIcon : Container, IHasTooltip
|
||||
{
|
||||
public readonly BindableBool Selected = new BindableBool();
|
||||
@ -28,9 +31,10 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
private readonly ModType type;
|
||||
|
||||
public virtual string TooltipText => mod.IconTooltip;
|
||||
public virtual string TooltipText => showTooltip ? mod.IconTooltip : null;
|
||||
|
||||
private Mod mod;
|
||||
private readonly bool showTooltip;
|
||||
|
||||
public Mod Mod
|
||||
{
|
||||
@ -42,9 +46,15 @@ namespace osu.Game.Rulesets.UI
|
||||
}
|
||||
}
|
||||
|
||||
public ModIcon(Mod mod)
|
||||
/// <summary>
|
||||
/// Construct a new instance.
|
||||
/// </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(Mod mod, bool showTooltip = true)
|
||||
{
|
||||
this.mod = mod ?? throw new ArgumentNullException(nameof(mod));
|
||||
this.showTooltip = showTooltip;
|
||||
|
||||
type = mod.Type;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user