Fix icons in main button system jumps on one side for a long time

This commit is contained in:
EVAST9919 2017-09-15 09:24:31 +03:00
parent a0bbabd18f
commit e7c9ad245e

View File

@ -121,13 +121,14 @@ namespace osu.Game.Screens.Menu
}; };
} }
private bool rightward;
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
{ {
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
if (!IsHovered) return; if (!IsHovered) return;
bool rightward = beatIndex % 2 == 1;
double duration = timingPoint.BeatLength / 2; double duration = timingPoint.BeatLength / 2;
icon.RotateTo(rightward ? 10 : -10, duration * 2, Easing.InOutSine); icon.RotateTo(rightward ? 10 : -10, duration * 2, Easing.InOutSine);
@ -139,6 +140,8 @@ namespace osu.Game.Screens.Menu
i => i.MoveToY(0, duration, Easing.In), i => i.MoveToY(0, duration, Easing.In),
i => i.ScaleTo(new Vector2(1, 0.9f), duration, Easing.In) i => i.ScaleTo(new Vector2(1, 0.9f), duration, Easing.In)
); );
rightward = !rightward;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
@ -152,7 +155,7 @@ namespace osu.Game.Screens.Menu
double duration = TimeUntilNextBeat; double duration = TimeUntilNextBeat;
icon.ClearTransforms(); icon.ClearTransforms();
icon.RotateTo(10, duration, Easing.InOutSine); icon.RotateTo(rightward ? -10 : 10, duration, Easing.InOutSine);
icon.ScaleTo(new Vector2(1, 0.9f), duration, Easing.Out); icon.ScaleTo(new Vector2(1, 0.9f), duration, Easing.Out);
return true; return true;
} }