Fix kiai flash being visible and incorrectly sized during hit animation

This commit is contained in:
Dean Herbert 2023-01-26 15:24:10 +09:00
parent 73f53328cf
commit de1d473d29
1 changed files with 11 additions and 4 deletions

View File

@ -44,7 +44,7 @@ public partial class ArgonMainCirclePiece : CompositeDrawable
private readonly IBindable<Color4> accentColour = new Bindable<Color4>(); private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>(); private readonly IBindable<int> indexInCurrentCombo = new Bindable<int>();
private readonly FlashPiece flash; private readonly FlashPiece flash;
private readonly KiaiFlash kiaiFlash; private readonly Container kiaiContainer;
private Bindable<bool> configHitLighting = null!; private Bindable<bool> configHitLighting = null!;
@ -83,11 +83,13 @@ public ArgonMainCirclePiece(bool withOuterFill)
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}, },
new CircularContainer kiaiContainer = new CircularContainer
{ {
Masking = true, Masking = true,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = Size, Size = Size,
Child = kiaiFlash = new KiaiFlash Child = new KiaiFlash
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
} }
@ -129,7 +131,7 @@ protected override void LoadComplete()
outerGradient.ClearTransforms(targetMember: nameof(Colour)); outerGradient.ClearTransforms(targetMember: nameof(Colour));
outerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.1f)); outerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.1f));
kiaiFlash.Colour = colour.NewValue; kiaiContainer.Colour = colour.NewValue;
outerFill.Colour = innerFill.Colour = colour.NewValue.Darken(4); outerFill.Colour = innerFill.Colour = colour.NewValue.Darken(4);
innerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue.Darken(0.5f), colour.NewValue.Darken(0.6f)); innerGradient.Colour = ColourInfo.GradientVertical(colour.NewValue.Darken(0.5f), colour.NewValue.Darken(0.6f));
flash.Colour = colour.NewValue; flash.Colour = colour.NewValue;
@ -191,6 +193,11 @@ private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedSta
// gradient layers. // gradient layers.
border.ResizeTo(Size * shrink_size + new Vector2(border.BorderThickness), resize_duration, Easing.OutElasticHalf); border.ResizeTo(Size * shrink_size + new Vector2(border.BorderThickness), resize_duration, Easing.OutElasticHalf);
// Kiai flash should track the overall size but also be cleaned up quite fast, so we don't get additional
// flashes after the hit animation is already in a mostly-completed state.
kiaiContainer.ResizeTo(Size * shrink_size, resize_duration, Easing.OutElasticHalf);
kiaiContainer.FadeOut(flash_in_duration, Easing.OutQuint);
// The outer gradient is resize with a slight delay from the border. // The outer gradient is resize with a slight delay from the border.
// This is to give it a bomb-like effect, with the border "triggering" its animation when getting close. // This is to give it a bomb-like effect, with the border "triggering" its animation when getting close.
using (BeginDelayedSequence(flash_in_duration / 12)) using (BeginDelayedSequence(flash_in_duration / 12))