mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add the ability to override Highlighted action to the ModIcon
This commit is contained in:
@ -34,9 +34,11 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
public virtual string TooltipText { get; }
|
||||
|
||||
protected Mod Mod { get; private set; }
|
||||
|
||||
public ModIcon(Mod mod)
|
||||
{
|
||||
if (mod == null) throw new ArgumentNullException(nameof(mod));
|
||||
Mod = mod ?? throw new ArgumentNullException(nameof(mod));
|
||||
|
||||
type = mod.Type;
|
||||
|
||||
@ -106,12 +108,19 @@ namespace osu.Game.Rulesets.UI
|
||||
modIcon.Colour = colours.Yellow;
|
||||
break;
|
||||
}
|
||||
|
||||
background.Colour = backgroundColour;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Highlighted.BindValueChanged(highlighted => background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour, true);
|
||||
Highlighted.BindValueChanged(OnHighlightedChange, true);
|
||||
}
|
||||
|
||||
protected virtual void OnHighlightedChange(ValueChangedEvent<bool> highlighted)
|
||||
{
|
||||
background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user