Fix incorrect application of scaling in some cases

Isolates different usages of hitcircle scale so they can't ever cause regressions.
This commit is contained in:
Dean Herbert 2019-02-14 18:47:05 +09:00
parent 1b61ec4ef4
commit 810175235d
2 changed files with 59 additions and 29 deletions

View File

@ -44,19 +44,30 @@ protected virtual void ApplyCustomState(DrawableHitObject drawable, ArmedState s
{
var h = (OsuHitObject)drawable.HitObject;
var scale = drawable.Scale;
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
drawable.ScaleTo(scale / 2).Then().ScaleTo(scale, h.TimePreempt, Easing.OutSine);
// apply grow effect
switch (drawable)
{
case DrawableSliderHead _:
case DrawableSliderTail _:
// special cases we should *not* be scaling.
break;
case DrawableSlider _:
case DrawableHitCircle _:
{
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
drawable.ScaleTo(0.5f).Then().ScaleTo(1, h.TimePreempt, Easing.OutSine);
break;
}
}
// remove approach circles
switch (drawable)
{
case DrawableHitCircle circle:
{
// we don't want to see the approach circle
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
circle.ApproachCircle.Hide();
break;
}
}
}
}

View File

@ -5,6 +5,7 @@
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osuTK;
@ -27,40 +28,58 @@ public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithPro
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
private readonly IBindable<float> scaleBindable = new Bindable<float>();
private readonly Container explodeContainer;
private readonly Container scaleContainer;
public DrawableHitCircle(HitCircle h)
: base(h)
{
Origin = Anchor.Centre;
Position = HitObject.StackedPosition;
Scale = new Vector2(h.Scale);
InternalChildren = new Drawable[]
{
glow = new GlowPiece(),
circle = new CirclePiece
scaleContainer = new Container
{
Hit = () =>
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Child = explodeContainer = new Container
{
if (AllJudged)
return false;
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Children = new Drawable[]
{
glow = new GlowPiece(),
circle = new CirclePiece
{
Hit = () =>
{
if (AllJudged)
return false;
UpdateResult(true);
return true;
},
UpdateResult(true);
return true;
},
},
number = new NumberPiece
{
Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
},
ring = new RingPiece(),
flash = new FlashPiece(),
explode = new ExplodePiece(),
ApproachCircle = new ApproachCircle
{
Alpha = 0,
Scale = new Vector2(4),
}
}
}
},
number = new NumberPiece
{
Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
},
ring = new RingPiece(),
flash = new FlashPiece(),
explode = new ExplodePiece(),
ApproachCircle = new ApproachCircle
{
Alpha = 0,
Scale = new Vector2(4),
}
};
//may not be so correct
@ -72,7 +91,7 @@ private void load()
{
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
scaleBindable.BindValueChanged(v => Scale = new Vector2(v));
scaleBindable.BindValueChanged(v => scaleContainer.Scale = new Vector2(v), true);
positionBindable.BindTo(HitObject.PositionBindable);
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
@ -156,8 +175,8 @@ protected override void UpdateCurrentState(ArmedState state)
circle.FadeOut();
number.FadeOut();
this.FadeOut(800)
.ScaleTo(Scale * 1.5f, 400, Easing.OutQuad);
this.FadeOut(800);
explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad);
}
Expire();