mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 19:22:56 +08:00
Manually reset rest of rotation tracker state on object application
This commit is contained in:
parent
727a886fb3
commit
532680bb36
@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Screens.Play;
|
||||
using osuTK;
|
||||
|
||||
@ -22,6 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
public SpinnerRotationTracker(DrawableSpinner drawableSpinner)
|
||||
{
|
||||
this.drawableSpinner = drawableSpinner;
|
||||
drawableSpinner.HitObjectApplied += resetState;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
@ -107,5 +109,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
// (see: ModTimeRamp)
|
||||
drawableSpinner.Result.RateAdjustedRotation += (float)(Math.Abs(angle) * (gameplayClock?.TrueGameplayRate ?? Clock.Rate));
|
||||
}
|
||||
|
||||
private void resetState(DrawableHitObject obj)
|
||||
{
|
||||
Tracking = false;
|
||||
IsSpinning.Value = false;
|
||||
mousePosition = default;
|
||||
lastAngle = currentRotation = Rotation = 0;
|
||||
rotationTransferred = false;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (drawableSpinner != null)
|
||||
drawableSpinner.HitObjectApplied -= resetState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user