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

Fix subscribing to ApplyCustomUpdateState too much

This commit is contained in:
Bartłomiej Dach 2024-02-28 13:20:41 +01:00
parent bbdd85020c
commit b5ce2642aa
No known key found for this signature in database

View File

@ -85,7 +85,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// as they may be cleared via the `updateState()` DHO flow, // as they may be cleared via the `updateState()` DHO flow,
// so use `ApplyCustomUpdateState` instead. which does not have this pitfall. // so use `ApplyCustomUpdateState` instead. which does not have this pitfall.
if (piece is DrawableHitObject drawableObjectPiece) if (piece is DrawableHitObject drawableObjectPiece)
drawableObjectPiece.ApplyCustomUpdateState += (dho, _) => applyDim(dho); {
// this method can be called multiple times, and we don't want to subscribe to the event more than once,
// so this is what it is going to have to be...
drawableObjectPiece.ApplyCustomUpdateState -= applyDimToDrawableHitObject;
drawableObjectPiece.ApplyCustomUpdateState += applyDimToDrawableHitObject;
}
else else
applyDim(piece); applyDim(piece);
} }
@ -96,6 +101,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
using (piece.BeginDelayedSequence(InitialLifetimeOffset - OsuHitWindows.MISS_WINDOW)) using (piece.BeginDelayedSequence(InitialLifetimeOffset - OsuHitWindows.MISS_WINDOW))
piece.FadeColour(Color4.White, 100); piece.FadeColour(Color4.White, 100);
} }
void applyDimToDrawableHitObject(DrawableHitObject dho, ArmedState _) => applyDim(dho);
} }
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt; protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;