1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 20:12:57 +08:00

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 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
var h = (OsuHitObject)drawable.HitObject; var h = (OsuHitObject)drawable.HitObject;
var scale = drawable.Scale; // apply grow effect
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) switch (drawable)
drawable.ScaleTo(scale / 2).Then().ScaleTo(scale, h.TimePreempt, Easing.OutSine); {
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) switch (drawable)
{ {
case DrawableHitCircle circle: case DrawableHitCircle circle:
{
// we don't want to see the approach circle // we don't want to see the approach circle
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
circle.ApproachCircle.Hide(); circle.ApproachCircle.Hide();
break; break;
}
} }
} }
} }

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osuTK; using osuTK;
@ -27,40 +28,58 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly IBindable<int> stackHeightBindable = new Bindable<int>(); private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
private readonly IBindable<float> scaleBindable = new Bindable<float>(); private readonly IBindable<float> scaleBindable = new Bindable<float>();
private readonly Container explodeContainer;
private readonly Container scaleContainer;
public DrawableHitCircle(HitCircle h) public DrawableHitCircle(HitCircle h)
: base(h) : base(h)
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Position = HitObject.StackedPosition; Position = HitObject.StackedPosition;
Scale = new Vector2(h.Scale);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
glow = new GlowPiece(), scaleContainer = new Container
circle = new CirclePiece
{ {
Hit = () => RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Child = explodeContainer = new Container
{ {
if (AllJudged) RelativeSizeAxes = Axes.Both,
return false; Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Children = new Drawable[]
{
glow = new GlowPiece(),
circle = new CirclePiece
{
Hit = () =>
{
if (AllJudged)
return false;
UpdateResult(true); UpdateResult(true);
return 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 //may not be so correct
@ -72,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
stackHeightBindable.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); positionBindable.BindTo(HitObject.PositionBindable);
stackHeightBindable.BindTo(HitObject.StackHeightBindable); stackHeightBindable.BindTo(HitObject.StackHeightBindable);
@ -156,8 +175,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
circle.FadeOut(); circle.FadeOut();
number.FadeOut(); number.FadeOut();
this.FadeOut(800) this.FadeOut(800);
.ScaleTo(Scale * 1.5f, 400, Easing.OutQuad); explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad);
} }
Expire(); Expire();