mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Let disabled icon buttons be interactive again
This commit is contained in:
@ -84,42 +84,17 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
flashColour = colours.Yellow;
|
flashColour = colours.Yellow;
|
||||||
disableColour = colours.Gray9;
|
disableColour = colours.Gray9;
|
||||||
|
|
||||||
Enabled.ValueChanged += enabledChanged;
|
Enabled.ValueChanged += newEnabled => FadeColour(newEnabled ? Color4.White : disableColour, 200, EasingTypes.OutQuint);
|
||||||
}
|
|
||||||
|
|
||||||
private void enabledChanged(bool newEnabled)
|
|
||||||
{
|
|
||||||
if (newEnabled)
|
|
||||||
{
|
|
||||||
FadeColour(Color4.White, 200, EasingTypes.OutQuint);
|
|
||||||
|
|
||||||
if (IsHovered)
|
|
||||||
OnHover(new InputState());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FadeColour(disableColour, 200, EasingTypes.OutQuint);
|
|
||||||
content.ScaleTo(1, 200, EasingTypes.OutElastic);
|
|
||||||
|
|
||||||
if (IsHovered)
|
|
||||||
OnHoverLost(new InputState());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
if (!Enabled.Value)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
hover.FadeIn(500, EasingTypes.OutQuint);
|
hover.FadeIn(500, EasingTypes.OutQuint);
|
||||||
return base.OnHover(state);
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
if (!Enabled.Value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
hover.FadeOut(500, EasingTypes.OutQuint);
|
hover.FadeOut(500, EasingTypes.OutQuint);
|
||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
@ -132,18 +107,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (!Enabled.Value)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
content.ScaleTo(0.75f, 2000, EasingTypes.OutQuint);
|
content.ScaleTo(0.75f, 2000, EasingTypes.OutQuint);
|
||||||
return base.OnMouseDown(state, args);
|
return base.OnMouseDown(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||||
{
|
{
|
||||||
if (!Enabled.Value)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
content.ScaleTo(1, 1000, EasingTypes.OutElastic);
|
content.ScaleTo(1, 1000, EasingTypes.OutElastic);
|
||||||
return base.OnMouseUp(state, args);
|
return base.OnMouseUp(state, args);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user