mirror of
https://github.com/ppy/osu
synced 2025-02-04 04:11:54 +00:00
Add method for any mouse button pressed.
This commit is contained in:
parent
89d973416a
commit
3fa02a5782
@ -15,6 +15,7 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Screens.Multi.Components;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Cursor
|
namespace osu.Game.Graphics.Cursor
|
||||||
{
|
{
|
||||||
@ -83,7 +84,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
|
activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldRotate(e) && cursorRotate.Value)
|
if (shouldRotateCursor(e) && cursorRotate.Value)
|
||||||
{
|
{
|
||||||
// if cursor is already rotating don't reset its rotate origin
|
// if cursor is already rotating don't reset its rotate origin
|
||||||
if (!(dragRotationState == DragRotationState.Rotating))
|
if (!(dragRotationState == DragRotationState.Rotating))
|
||||||
@ -99,13 +100,13 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
protected override void OnMouseUp(MouseUpEvent e)
|
protected override void OnMouseUp(MouseUpEvent e)
|
||||||
{
|
{
|
||||||
// cursor should go back to original size when none of main buttons are pressed
|
// cursor should go back to original size when none of main buttons are pressed
|
||||||
if (!(e.IsPressed(MouseButton.Left) || e.IsPressed(MouseButton.Middle) || e.IsPressed(MouseButton.Right)))
|
if (!anyMouseButtonPressed(e))
|
||||||
{
|
{
|
||||||
activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint);
|
activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint);
|
||||||
activeCursor.ScaleTo(1, 500, Easing.OutElastic);
|
activeCursor.ScaleTo(1, 500, Easing.OutElastic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldRotate(e))
|
if (!shouldRotateCursor(e))
|
||||||
{
|
{
|
||||||
if (dragRotationState == DragRotationState.Rotating)
|
if (dragRotationState == DragRotationState.Rotating)
|
||||||
activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf);
|
activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf);
|
||||||
@ -127,7 +128,9 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
activeCursor.ScaleTo(0.6f, 250, Easing.In);
|
activeCursor.ScaleTo(0.6f, 250, Easing.In);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool shouldRotate(MouseEvent e) => e.IsPressed(MouseButton.Left) || e.IsPressed(MouseButton.Right);
|
private static bool shouldRotateCursor(MouseEvent e) => e.IsPressed(MouseButton.Left) || e.IsPressed(MouseButton.Right);
|
||||||
|
|
||||||
|
private static bool anyMouseButtonPressed(MouseEvent e) => e.IsPressed(MouseButton.Left) || e.IsPressed(MouseButton.Middle) || e.IsPressed(MouseButton.Right);
|
||||||
|
|
||||||
public class Cursor : Container
|
public class Cursor : Container
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user