mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 20:33:11 +08:00
add disable
This commit is contained in:
parent
e8d170e772
commit
1186ed3e32
@ -31,6 +31,31 @@ namespace osu.Game.Screens.Select.Options
|
||||
private readonly OsuSpriteText secondLine;
|
||||
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
|
||||
{
|
||||
get => background.Colour;
|
||||
@ -57,18 +82,24 @@ namespace osu.Game.Screens.Select.Options
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (disabled) return true;
|
||||
|
||||
flash.FadeTo(0.1f, 1000, Easing.OutQuint);
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
if (disabled) return;
|
||||
|
||||
flash.FadeTo(0, 1000, Easing.OutQuint);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (disabled) return true;
|
||||
|
||||
flash.ClearTransforms();
|
||||
flash.Alpha = 0.9f;
|
||||
flash.FadeOut(800, Easing.OutExpo);
|
||||
|
Loading…
Reference in New Issue
Block a user