mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Merge pull request #27401 from bdach/fix-slider-tail-dim
Fix slider tails sometimes not dimming correctly
This commit is contained in:
commit
4506ad23a0
@ -80,11 +80,29 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
base.UpdateInitialTransforms();
|
base.UpdateInitialTransforms();
|
||||||
|
|
||||||
foreach (var piece in DimmablePieces)
|
foreach (var piece in DimmablePieces)
|
||||||
|
{
|
||||||
|
// if the specified dimmable piece is a DHO, it is generally not safe to tack transforms onto it directly
|
||||||
|
// as they may be cleared via the `updateState()` DHO flow,
|
||||||
|
// so use `ApplyCustomUpdateState` instead. which does not have this pitfall.
|
||||||
|
if (piece is DrawableHitObject drawableObjectPiece)
|
||||||
|
{
|
||||||
|
// 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
|
||||||
|
applyDim(piece);
|
||||||
|
}
|
||||||
|
|
||||||
|
void applyDim(Drawable piece)
|
||||||
{
|
{
|
||||||
piece.FadeColour(new Color4(195, 195, 195, 255));
|
piece.FadeColour(new Color4(195, 195, 195, 255));
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user