1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:52:55 +08:00

Fix GameplayCursor state not restoring correctly after Show/Hide

This commit is contained in:
Dean Herbert 2018-07-10 14:41:07 +09:00
parent d0f7bdbcb8
commit ffd3040fe2

View File

@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private int downCount; private int downCount;
private const float pressed_scale = 1.2f;
private const float released_scale = 1f;
private float targetScale => downCount > 0 ? pressed_scale : released_scale;
public bool OnPressed(OsuAction action) public bool OnPressed(OsuAction action)
{ {
switch (action) switch (action)
@ -46,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
case OsuAction.LeftButton: case OsuAction.LeftButton:
case OsuAction.RightButton: case OsuAction.RightButton:
downCount++; downCount++;
ActiveCursor.ScaleTo(1).ScaleTo(1.2f, 100, Easing.OutQuad); ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad);
break; break;
} }
@ -60,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
case OsuAction.LeftButton: case OsuAction.LeftButton:
case OsuAction.RightButton: case OsuAction.RightButton:
if (--downCount == 0) if (--downCount == 0)
ActiveCursor.ScaleTo(1, 200, Easing.OutQuad); ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad);
break; break;
} }
@ -72,13 +77,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
protected override void PopIn() protected override void PopIn()
{ {
fadeContainer.FadeTo(1, 300, Easing.OutQuint); fadeContainer.FadeTo(1, 300, Easing.OutQuint);
ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); ActiveCursor.ScaleTo(targetScale, 400, Easing.OutQuint);
} }
protected override void PopOut() protected override void PopOut()
{ {
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint); fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint); ActiveCursor.ScaleTo(targetScale * 0.8f, 450, Easing.OutQuint);
} }
public class OsuCursor : Container public class OsuCursor : Container