From 440878945e03c5f089e5ae07eb194bbe551c78c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 17 Jul 2017 18:16:15 +0300 Subject: [PATCH] Remove remaining usages of AddDelay --- osu-framework | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 2 +- .../Objects/Drawables/DrawableBarLine.cs | 3 +- .../Objects/Drawables/DrawableHit.cs | 57 +++++++++---------- .../Objects/Drawables/DrawableSwell.cs | 19 +++---- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 18 +++--- 6 files changed, 47 insertions(+), 54 deletions(-) diff --git a/osu-framework b/osu-framework index 8463ba949b..2410eba0d4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8463ba949b0a4a54c9aca157b2b24a8b0277608a +Subproject commit 2410eba0d4b0cdcfe8b7e0636d490a258ddebc6c diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 208705b723..c7d838e517 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -210,7 +210,7 @@ protected override void UpdateCurrentState(ArmedState state) break; } - sequence.Expire(); + Expire(); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index 3b5ecf244d..7507ee600e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -64,8 +64,7 @@ public DrawableBarLine(BarLine barLine) protected override void LoadComplete() { base.LoadComplete(); - AddDelay(BarLine.StartTime - Time.Current); - this.FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); + this.Delay(BarLine.StartTime - Time.Current).FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); } private void updateScrollPosition(double time) => this.MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime)); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 2e8f9d945b..b9d67d8d6a 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -65,45 +65,42 @@ protected override bool HandleKeyPress(Key key) protected override void UpdateState(ArmedState state) { - AddDelay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); - var circlePiece = MainPiece as CirclePiece; - circlePiece?.FlashBox.Flush(); - switch (State) + using (BeginDelayedSequence(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true)) { - case ArmedState.Idle: - AddDelay(HitObject.HitWindowMiss); - break; - case ArmedState.Miss: - this.FadeOut(100); - break; - case ArmedState.Hit: - this.FadeOut(600); + switch (State) + { + case ArmedState.Idle: + this.Delay(HitObject.HitWindowMiss).Expire(); + break; + case ArmedState.Miss: + this.FadeOut(100) + .Expire(); + break; + case ArmedState.Hit: + var flash = circlePiece?.FlashBox; + if (flash != null) + { + flash.FadeTo(0.9f); + flash.FadeOut(300); + } - var flash = circlePiece?.FlashBox; - if (flash != null) - { - flash.FadeTo(0.9f); - flash.FadeOut(300); - } + const float gravity_time = 300; + const float gravity_travel_height = 200; + Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); - this.FadeOut(800); + this.FadeOut(800) + .MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out) + .Then() + .MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); - const float gravity_time = 300; - const float gravity_travel_height = 200; - - Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); - - this.MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); - AddDelay(gravity_time, true); - this.MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); - break; + Expire(); + break; + } } - - Expire(); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 363dcae883..521d225abe 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -181,26 +181,21 @@ protected override void CheckJudgement(bool userTriggered) protected override void UpdateState(ArmedState state) { const float preempt = 100; - - AddDelay(HitObject.StartTime - Time.Current - preempt, true); - - targetRing.ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); - - AddDelay(preempt, true); - - AddDelay(Judgement.TimeOffset + HitObject.Duration, true); - const float out_transition_time = 300; + double untilStartTime = HitObject.StartTime - Time.Current; + double untilJudgement = untilStartTime + Judgement.TimeOffset + HitObject.Duration; + + targetRing.Delay(untilStartTime - preempt).ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); + this.Delay(untilJudgement).FadeOut(out_transition_time, EasingTypes.Out); + switch (state) { case ArmedState.Hit: - bodyContainer.ScaleTo(1.4f, out_transition_time); + bodyContainer.Delay(untilJudgement).ScaleTo(1.4f, out_transition_time); break; } - this.FadeOut(out_transition_time, EasingTypes.Out); - Expire(); } diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 737f5d344e..a413d77d16 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -149,15 +149,17 @@ protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) const float down_time = 40; const float up_time = 1000; - back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); - back.AddDelay(down_time); - back.ScaleTo(1, up_time, EasingTypes.OutQuint); + back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint) + .Then() + .ScaleTo(1, up_time, EasingTypes.OutQuint); - target.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); - target.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint); - target.AddDelay(down_time); - target.ScaleTo(1, up_time, EasingTypes.OutQuint); - target.FadeOut(up_time, EasingTypes.OutQuint); + target.Animate( + t => t.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint), + t => t.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint) + ).Then( + t => t.ScaleTo(1, up_time, EasingTypes.OutQuint), + t => t.FadeOut(up_time, EasingTypes.OutQuint) + ); } return false;