mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
ModIcon improvements
This commit is contained in:
parent
6b1132c5ca
commit
1d42f0959a
@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
}
|
||||
|
||||
foregroundIcon.Highlighted = Selected;
|
||||
foregroundIcon.Highlighted.Value = Selected;
|
||||
|
||||
SelectionChanged?.Invoke(SelectedMod);
|
||||
return true;
|
||||
|
@ -11,11 +11,14 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osuTK;
|
||||
using osu.Framework.Bindables;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
public class ModIcon : Container, IHasTooltip
|
||||
{
|
||||
public readonly BindableBool Highlighted = new BindableBool();
|
||||
|
||||
private readonly SpriteIcon modIcon;
|
||||
private readonly SpriteIcon background;
|
||||
|
||||
@ -97,26 +100,12 @@ namespace osu.Game.Rulesets.UI
|
||||
highlightedColour = colours.PinkLight;
|
||||
break;
|
||||
}
|
||||
|
||||
applyStyle();
|
||||
}
|
||||
|
||||
private bool highlighted;
|
||||
|
||||
public bool Highlighted
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
get => highlighted;
|
||||
|
||||
set
|
||||
{
|
||||
highlighted = value;
|
||||
applyStyle();
|
||||
}
|
||||
}
|
||||
|
||||
private void applyStyle()
|
||||
{
|
||||
background.Colour = highlighted ? highlightedColour : backgroundColour;
|
||||
base.LoadComplete();
|
||||
Highlighted.BindValueChanged(highlighted => background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user