From 0c1023da3115e3741703f2e4eb719077ac2374ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Jun 2021 17:27:52 +0900 Subject: [PATCH] Simplify transform logic --- .../Mods/OsuModApproachDifferent.cs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs b/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs index d01c036768..8f772e88ac 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs @@ -39,27 +39,23 @@ namespace osu.Game.Rulesets.Osu.Mods { drawables.ForEach(drawable => { - drawable.ApplyCustomUpdateState += (drawableHitObj, state) => + drawable.ApplyCustomUpdateState += (drawableObject, state) => { - if (!(drawableHitObj is DrawableHitCircle hitCircle)) return; + if (!(drawableObject is DrawableHitCircle drawableHitCircle)) return; - var obj = hitCircle.HitObject; + var hitCircle = drawableHitCircle.HitObject; - hitCircle.BeginAbsoluteSequence(obj.StartTime - obj.TimePreempt, true); - hitCircle.ApproachCircle.ScaleTo(Scale.Value); + drawableHitCircle.ApproachCircle.ClearTransforms(targetMember: nameof(Scale)); - hitCircle.ApproachCircle.FadeIn(Math.Min(obj.TimeFadeIn, obj.TimePreempt)); - - hitCircle.ApproachCircle.ScaleTo(1f, obj.TimePreempt, getEasing(Style.Value)); - - hitCircle.ApproachCircle.Expire(true); + using (drawableHitCircle.BeginAbsoluteSequence(hitCircle.StartTime - hitCircle.TimePreempt)) + drawableHitCircle.ApproachCircle.ScaleTo(Scale.Value).ScaleTo(1f, hitCircle.TimePreempt, getEasing(Style.Value)); }; }); } - private Easing getEasing(AnimationStyle approachEasing) + private Easing getEasing(AnimationStyle style) { - switch (approachEasing) + switch (style) { default: return Easing.None;