Add support for 'disabled' sample variation to HoverClickSounds

This commit is contained in:
Jamie Taylor
2022-11-03 17:44:54 +09:00
parent c48c9ecb6d
commit f1c17129eb
8 changed files with 34 additions and 7 deletions

View File

@ -24,6 +24,7 @@ namespace osu.Game.Graphics.UserInterface
private const int transition_length = 80;
private TextContainer text;
private HoverClickSounds hoverClickSounds;
public DrawableOsuMenuItem(MenuItem item)
: base(item)
@ -36,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface
BackgroundColour = Color4.Transparent;
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
AddInternal(new HoverClickSounds());
AddInternal(hoverClickSounds = new HoverClickSounds());
updateTextColour();
@ -76,6 +77,7 @@ namespace osu.Game.Graphics.UserInterface
private void updateState()
{
hoverClickSounds.Enabled.Value = !Item.Action.Disabled;
Alpha = Item.Action.Disabled ? 0.2f : 1;
if (IsHovered && !Item.Action.Disabled)