mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
add disable
This commit is contained in:
@ -31,6 +31,31 @@ namespace osu.Game.Screens.Select.Options
|
|||||||
private readonly OsuSpriteText secondLine;
|
private readonly OsuSpriteText secondLine;
|
||||||
private readonly Container box;
|
private readonly Container box;
|
||||||
|
|
||||||
|
private readonly float disabledAlpha = 0.5f;
|
||||||
|
|
||||||
|
private bool disabled;
|
||||||
|
|
||||||
|
public bool Disabled
|
||||||
|
{
|
||||||
|
get => disabled;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
disabled = value;
|
||||||
|
|
||||||
|
if (disabled)
|
||||||
|
{
|
||||||
|
firstLine.Alpha = disabledAlpha;
|
||||||
|
secondLine.Alpha = disabledAlpha;
|
||||||
|
iconText.Alpha = disabledAlpha;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstLine.Alpha = 1;
|
||||||
|
secondLine.Alpha = 1;
|
||||||
|
iconText.Alpha = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Color4 ButtonColour
|
public Color4 ButtonColour
|
||||||
{
|
{
|
||||||
get => background.Colour;
|
get => background.Colour;
|
||||||
@ -57,18 +82,24 @@ namespace osu.Game.Screens.Select.Options
|
|||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
|
if (disabled) return true;
|
||||||
|
|
||||||
flash.FadeTo(0.1f, 1000, Easing.OutQuint);
|
flash.FadeTo(0.1f, 1000, Easing.OutQuint);
|
||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
|
if (disabled) return;
|
||||||
|
|
||||||
flash.FadeTo(0, 1000, Easing.OutQuint);
|
flash.FadeTo(0, 1000, Easing.OutQuint);
|
||||||
base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
|
if (disabled) return true;
|
||||||
|
|
||||||
flash.ClearTransforms();
|
flash.ClearTransforms();
|
||||||
flash.Alpha = 0.9f;
|
flash.Alpha = 0.9f;
|
||||||
flash.FadeOut(800, Easing.OutExpo);
|
flash.FadeOut(800, Easing.OutExpo);
|
||||||
|
Reference in New Issue
Block a user