Merge branch 'master' into add-messagepack

This commit is contained in:
Dan Balasescu
2021-01-27 13:00:46 +09:00
committed by GitHub
11 changed files with 319 additions and 60 deletions

View File

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