Fix PopIn and PopOut resetting cursor scale

This commit is contained in:
HoLLy-HaCKeR 2019-10-12 10:04:14 +02:00
parent 1c22fb485f
commit 13924174c4

View File

@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private Bindable<float> cursorScale; private Bindable<float> cursorScale;
private Bindable<bool> autoCursorScale; private Bindable<bool> autoCursorScale;
private float calculatedCursorScale;
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>(); private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
public OsuCursorContainer() public OsuCursorContainer()
@ -69,6 +70,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY; scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
} }
calculatedCursorScale = scale;
ActiveCursor.Scale = cursorTrail.Scale = new Vector2(scale); ActiveCursor.Scale = cursorTrail.Scale = new Vector2(scale);
} }
@ -125,13 +127,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(calculatedCursorScale, 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(calculatedCursorScale * 0.8f, 450, Easing.OutQuint);
} }
private class DefaultCursorTrail : CursorTrail private class DefaultCursorTrail : CursorTrail