From 4ab636cbb80e090867f699707f88e028e79591bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 17:37:38 +0900 Subject: [PATCH 1/6] Update osu! drawables to use TransformSequences. --- .../Objects/Drawables/DrawableHitCircle.cs | 4 +--- .../Objects/Drawables/DrawableOsuHitObject.cs | 14 ++++++++++---- .../Objects/Drawables/DrawableSlider.cs | 6 ++---- .../Objects/Drawables/DrawableSliderTick.cs | 6 ++---- .../Objects/Drawables/DrawableSpinner.cs | 4 +--- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 4c1a74c675..09bfffeefe 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -104,10 +104,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ApproachCircle.ScaleTo(1.1f, TIME_PREEMPT); } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - ApproachCircle.FadeOut(); double endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 2baf651cc0..60684f2042 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -21,17 +21,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 }; - protected override void UpdateState(ArmedState state) + protected override sealed void UpdateState(ArmedState state) { Flush(); UpdateInitialState(); - Delay(HitObject.StartTime - Time.Current - TIME_PREEMPT + Judgement.TimeOffset, true); + using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) + { + UpdatePreemptState(); - UpdatePreemptState(); + using (BeginDelayedSequence(TIME_PREEMPT + Judgement.TimeOffset, true)) + UpdateCurrentState(state); + } + } - Delay(TIME_PREEMPT, true); + protected virtual void UpdateCurrentState(ArmedState state) + { } protected virtual void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index ed698f5ad3..b80f1d7178 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -158,10 +158,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ball.Alpha = 0; } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - ball.FadeIn(); Delay(slider.Duration, true); @@ -181,4 +179,4 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { void UpdateProgress(double progress, int repeat); } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 86baf9f235..6b4d40e080 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -72,10 +72,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Delay(-animIn); } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - switch (state) { case ArmedState.Idle: @@ -93,4 +91,4 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 4623fe7f22..90a6d432c4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -132,10 +132,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables disc.FadeIn(200); } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - Delay(spinner.Duration, true); FadeOut(160); From 59a3e23879891e7c488bb7af95a544e99ec0564f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 17:38:00 +0900 Subject: [PATCH 2/6] Ensure PlayerInputManager's initial time is transferred at load. --- osu.Game/Screens/Play/PlayerInputManager.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index f961286818..9707ccbc35 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play { public class PlayerInputManager : PassThroughInputManager { - private readonly ManualClock clock = new ManualClock(); + private ManualClock clock; private IFrameBasedClock parentClock; private ReplayInputHandler replayInputHandler; @@ -47,8 +47,14 @@ namespace osu.Game.Screens.Play { base.LoadComplete(); + //our clock will now be our parent's clock, but we want to replace this to allow manual control. parentClock = Clock; - Clock = new FramedClock(clock); + + Clock = new FramedClock(clock = new ManualClock + { + CurrentTime = parentClock.CurrentTime, + Rate = parentClock.Rate, + }); } /// From 12c0a177118a0858526edc6517e0bb5be4dafe35 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 18:07:10 +0900 Subject: [PATCH 3/6] Make FollowPoints dumb; use absolute sequence at renderer level. --- .../Drawables/Connections/FollowPoint.cs | 24 +------------------ .../Connections/FollowPointRenderer.cs | 23 ++++++++++++++---- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs index e1276f30c4..9f8ff17853 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -12,16 +12,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPoint : Container { - public double StartTime; - public double EndTime; - public Vector2 EndPosition; - private const float width = 8; public FollowPoint() { Origin = Anchor.Centre; - Alpha = 0; Masking = true; AutoSizeAxes = Axes.Both; @@ -45,22 +40,5 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections }, }; } - - protected override void LoadComplete() - { - base.LoadComplete(); - - Delay(StartTime); - FadeIn(DrawableOsuHitObject.TIME_FADEIN); - ScaleTo(1.5f); - ScaleTo(1, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - MoveTo(EndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - - Delay(EndTime - StartTime); - FadeOut(DrawableOsuHitObject.TIME_FADEIN); - - Delay(DrawableOsuHitObject.TIME_FADEIN); - Expire(true); - } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index a4e032050e..925767b851 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using OpenTK; +using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections @@ -80,14 +81,28 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections double fadeOutTime = startTime + fraction * duration; double fadeInTime = fadeOutTime - PreEmpt; - Add(new FollowPoint + FollowPoint fp; + + Add(fp = new FollowPoint { - StartTime = fadeInTime, - EndTime = fadeOutTime, Position = pointStartPosition, - EndPosition = pointEndPosition, Rotation = rotation, + Alpha = 0, + Scale = new Vector2(1.5f), }); + + using (fp.BeginAbsoluteSequence(fadeInTime)) + { + fp.FadeIn(DrawableOsuHitObject.TIME_FADEIN); + fp.ScaleTo(1, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); + + fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); + + fp.Delay(fadeOutTime - fadeInTime); + fp.FadeOut(DrawableOsuHitObject.TIME_FADEIN); + } + + fp.Expire(true); } } prevHitObject = currHitObject; From 94c259bd59a4d93f14fee6a54abe8210992ec5e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 18:39:40 +0900 Subject: [PATCH 4/6] Remove most usages of DelayReset ButtonSystem requires some more work. --- osu-framework | 2 +- .../Objects/Drawables/DrawableSwell.cs | 5 ++-- .../Graphics/UserInterface/StarCounter.cs | 14 ++++----- osu.Game/Screens/Ranking/Results.cs | 30 ++++++++++--------- .../Tournament/ScrollingTeamContainer.cs | 10 ++----- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/osu-framework b/osu-framework index dcbd7a0b6f..07fd653f42 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit dcbd7a0b6f536f6aadf13a720db40a1d76bf52e2 +Subproject commit 07fd653f422bfb7faf382f46b731c18eed24baae diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 57b2576a8b..37efd8aba4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -148,9 +148,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables var completion = (float)userHits / HitObject.RequiredHits; expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50); - expandingRing.Delay(50); - expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); - expandingRing.DelayReset(); + using (expandingRing.BeginDelayedSequence(50)) + expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint); diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index c046749dad..295cdac81d 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -131,14 +131,14 @@ namespace osu.Game.Graphics.UserInterface foreach (var star in stars.Children) { star.ClearTransforms(true); - if (count <= newValue) - star.Delay(Math.Max(i - count, 0) * animationDelay, true); - else - star.Delay(Math.Max(count - 1 - i, 0) * animationDelay, true); - star.FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); - star.Icon.ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); - star.DelayReset(); + var delay = (count <= newValue ? Math.Max(i - count, 0) : Math.Max(count - 1 - i, 0)) * animationDelay; + + using (BeginDelayedSequence(delay, true)) + { + star.FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); + star.Icon.ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); + } i++; } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index ffe72966f5..5bcaba7813 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -70,24 +70,26 @@ namespace osu.Game.Screens.Ranking circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint); circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(transition_time * 0.25f, true); + using (BeginDelayedSequence(transition_time * 0.25f, true)) + { - circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(transition_time * 0.3f, true); + using (BeginDelayedSequence(transition_time * 0.3f, true)) + { + backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); - backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); + circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); - circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); - - Content.Delay(transition_time * 0.4f, true); - - modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint); - currentPage.FadeIn(transition_time, EasingTypes.OutQuint); - - Content.DelayReset(); + using (BeginDelayedSequence(transition_time * 0.4f, true)) + { + modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint); + currentPage.FadeIn(transition_time, EasingTypes.OutQuint); + } + } + } } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 08f270741c..5783893b3d 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Tournament speedTo(0f, 2000); tracker.FadeIn(200); - delayedStateChangeDelegate = Delay(2300).Schedule(() => scrollState = ScrollState.Stopped); + delayedStateChangeDelegate = Scheduler.AddDelayed(() => scrollState = ScrollState.Stopped, 2300); break; case ScrollState.Stopped: // Find closest to center @@ -144,7 +144,7 @@ namespace osu.Game.Screens.Tournament st.Selected = true; OnSelected?.Invoke(st.Team); - delayedStateChangeDelegate = Delay(10000).Schedule(() => scrollState = ScrollState.Idle); + delayedStateChangeDelegate = Scheduler.AddDelayed(() => scrollState = ScrollState.Idle, 10000); break; case ScrollState.Idle: resetSelected(); @@ -295,11 +295,7 @@ namespace osu.Game.Screens.Tournament } } - private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) - { - DelayReset(); - TransformTo(() => speed, value, duration, easing, new TransformScrollSpeed()); - } + private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => TransformTo(() => speed, value, duration, easing, new TransformScrollSpeed()); private enum ScrollState { From e3236429b1cdb248fe28e65b93b413390fab726c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Apr 2017 13:21:03 +0900 Subject: [PATCH 5/6] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 07fd653f42..fc93e11439 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 07fd653f422bfb7faf382f46b731c18eed24baae +Subproject commit fc93e11439b8b391d9e01e208368d96ba85bfa26 From 220c602218dc808d65c132a29a28484d64c58303 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Apr 2017 13:27:20 +0900 Subject: [PATCH 6/6] Fix incorrect modifier order. --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 60684f2042..57a9804330 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 }; - protected override sealed void UpdateState(ArmedState state) + protected sealed override void UpdateState(ArmedState state) { Flush();