Skip to content

Commit

Permalink
Merge pull request #27401 from bdach/fix-slider-tail-dim
Browse files Browse the repository at this point in the history
Fix slider tails sometimes not dimming correctly
  • Loading branch information
peppy authored Feb 28, 2024
2 parents 964e772 + b5ce264 commit 4506ad2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,29 @@ protected override void UpdateInitialTransforms()
base.UpdateInitialTransforms();

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));
using (piece.BeginDelayedSequence(InitialLifetimeOffset - OsuHitWindows.MISS_WINDOW))
piece.FadeColour(Color4.White, 100);
}

void applyDimToDrawableHitObject(DrawableHitObject dho, ArmedState _) => applyDim(dho);
}

protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
Expand Down

0 comments on commit 4506ad2

Please sign in to comment.