Show "rewind" text on random button when beginning a right mouse press

This commit is contained in:
Dean Herbert 2023-05-17 14:42:07 +09:00
parent 94b184712d
commit 764f0323f4
1 changed files with 15 additions and 5 deletions

View File

@ -93,16 +93,22 @@ private void load(OsuColour colours)
protected override bool OnKeyDown(KeyDownEvent e)
{
updateText(e.ShiftPressed);
updateText(e);
return base.OnKeyDown(e);
}
protected override void OnKeyUp(KeyUpEvent e)
{
updateText(e.ShiftPressed);
updateText(e);
base.OnKeyUp(e);
}
protected override bool OnMouseDown(MouseDownEvent e)
{
updateText(e);
return base.OnMouseDown(e);
}
protected override bool OnClick(ClickEvent e)
{
try
@ -126,6 +132,8 @@ protected override void OnMouseUp(MouseUpEvent e)
rewindSearch = true;
TriggerClick();
}
updateText(e);
}
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
@ -150,10 +158,12 @@ public override void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
}
}
private void updateText(bool rewind = false)
private void updateText(UIEvent e)
{
randomSpriteText.Alpha = rewind ? 0 : 1;
rewindSpriteText.Alpha = rewind ? 1 : 0;
bool aboutToRewind = e.ShiftPressed || e.CurrentState.Mouse.IsPressed(MouseButton.Right);
randomSpriteText.Alpha = aboutToRewind ? 0 : 1;
rewindSpriteText.Alpha = aboutToRewind ? 1 : 0;
}
}
}