diff --git a/osu-framework b/osu-framework index 2d2e2fe698..8fde46d214 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 2d2e2fe698ab32d80d5e856f52c8c398ceb35540 +Subproject commit 8fde46d214e4ababb46100d2e4488ca26a9d43a3 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 5e9b976c8a..50d1df9964 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -177,9 +177,7 @@ namespace osu.Desktop.VisualTests.Tests beatsPerMinute.Value = 60000 / timingPoint.BeatLength; adjustedBeatLength.Value = timingPoint.BeatLength; - flashLayer.ClearTransforms(); - flashLayer.FadeTo(1); - flashLayer.FadeTo(0, timingPoint.BeatLength); + flashLayer.FadeOutFromOne(timingPoint.BeatLength); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index f9dc424153..bf8f9bf7f4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -59,20 +59,13 @@ namespace osu.Desktop.VisualTests.Tests { base.LoadComplete(); - using (container.BeginLoopedSequence()) - { - container.MoveTo(new Vector2(0, 100), duration); - using (container.BeginDelayedSequence(duration)) - { - container.MoveTo(new Vector2(100, 100), duration); - using (container.BeginDelayedSequence(duration)) - { - container.MoveTo(new Vector2(100, 0), duration); - using (container.BeginDelayedSequence(duration)) - container.MoveTo(Vector2.Zero, duration); - } - } - } + // Move box along a square trajectory + container.Loop(c => c + .MoveTo(new Vector2(0, 100), duration).Then() + .MoveTo(new Vector2(100, 100), duration).Then() + .MoveTo(new Vector2(100, 0), duration).Then() + .MoveTo(Vector2.Zero, duration) + ); } private class MyContextMenuContainer : Container, IHasContextMenu @@ -95,10 +88,10 @@ namespace osu.Desktop.VisualTests.Tests { new OsuContextMenuItem(@"Simple option"), new OsuContextMenuItem(@"Simple very very long option"), - new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, - new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => this.ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => this.ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => this.ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) }, + new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => this.ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) }, }; } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 4ba50c8220..849df1263e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -56,10 +56,7 @@ namespace osu.Desktop.VisualTests.Tests } if (remaining > 0) - { - Delay(80); - Schedule(() => sendBarrage(remaining - 1)); - } + Scheduler.AddDelayed(() => sendBarrage(remaining - 1), 80); } protected override void Update() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 8e5cf8687c..eed2fa95c1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -196,7 +196,7 @@ namespace osu.Desktop.VisualTests.Tests protected override void LoadComplete() { base.LoadComplete(); - FadeInFromZero(250, EasingTypes.OutQuint); + this.FadeInFromZero(250, EasingTypes.OutQuint); } protected override void Update() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 00929c06c2..8ca129eb91 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -67,6 +67,8 @@ namespace osu.Desktop.VisualTests.Tests private void changePlayfieldSize(int step) { + double delay = 0; + // Add new hits switch (step) { @@ -84,7 +86,7 @@ namespace osu.Desktop.VisualTests.Tests break; case 5: addSwell(1000); - playfieldContainer.Delay(scroll_time - 100); + delay = scroll_time - 100; break; } @@ -92,10 +94,10 @@ namespace osu.Desktop.VisualTests.Tests switch (step) { default: - playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); + playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); break; case 6: - playfieldContainer.ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500); + playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500); break; } } diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index a8ab97ce37..5b79ecfaf1 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -175,7 +175,7 @@ namespace osu.Desktop.Overlays protected override void PopIn() { - FadeIn(1000); + this.FadeIn(1000); } protected override void PopOut() diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 3feb448752..e74ad69d23 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -16,8 +16,6 @@ using System.Linq; using System.Collections.Generic; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Input; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Timing; using osu.Framework.Configuration; @@ -235,7 +233,7 @@ namespace osu.Game.Rulesets.Mania.UI private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None) { - TransformTo(newTimeRange, duration, easing, new TransformTimeSpan()); + this.TransformTo(nameof(visibleTimeRange), newTimeRange, duration, easing); } protected override void Update() @@ -244,23 +242,5 @@ namespace osu.Game.Rulesets.Mania.UI // While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually barLineContainer.Width = columns.Width; } - - private class TransformTimeSpan : Transform - { - public double CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((ManiaPlayfield)d).visibleTimeRange.Value = (float)CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ManiaPlayfield)d).visibleTimeRange.Value; - } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 925767b851..42c148b525 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -98,8 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - fp.Delay(fadeOutTime - fadeInTime); - fp.FadeOut(DrawableOsuHitObject.TIME_FADEIN); + fp.Delay(fadeOutTime - fadeInTime).FadeOut(DrawableOsuHitObject.TIME_FADEIN); } fp.Expire(true); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 75b2dc0a32..a890a0cdb4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -112,29 +112,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { double duration = ((HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime) - HitObject.StartTime; - using (glow.BeginDelayedSequence(duration)) - glow.FadeOut(400); + glow.Delay(duration).FadeOut(400); switch (state) { case ArmedState.Idle: - using (BeginDelayedSequence(duration + TIME_PREEMPT)) - FadeOut(TIME_FADEOUT); + this.Delay(duration + TIME_PREEMPT).FadeOut(TIME_FADEOUT); Expire(true); break; case ArmedState.Miss: ApproachCircle.FadeOut(50); - FadeOut(TIME_FADEOUT / 5); + this.FadeOut(TIME_FADEOUT / 5); Expire(); break; case ArmedState.Hit: ApproachCircle.FadeOut(50); const double flash_in = 40; - - flash.FadeTo(0.8f, flash_in); - using (flash.BeginDelayedSequence(flash_in)) - flash.FadeOut(100); + flash.FadeTo(0.8f, flash_in) + .Then() + .FadeOut(100); explode.FadeIn(flash_in); @@ -145,8 +142,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables circle.FadeOut(); number.FadeOut(); - FadeOut(800); - ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); + this.FadeOut(800) + .ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad); } Expire(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 2711ec1a62..ca1b44e1c7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; +using osu.Framework.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -24,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected sealed override void UpdateState(ArmedState state) { - Flush(); + FinishTransforms(); using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) { @@ -44,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected virtual void UpdatePreemptState() { - FadeIn(TIME_FADEIN); + this.FadeIn(TIME_FADEIN); } protected virtual void UpdateCurrentState(ArmedState state) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index c6c009e8f2..d5583b0d9d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -158,14 +158,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { ball.FadeIn(); - Delay(slider.Duration, true); + using (BeginDelayedSequence(slider.Duration, true)) + { + body.FadeOut(160); + ball.FadeOut(160); - body.FadeOut(160); - ball.FadeOut(160); - - FadeOut(800); - - Expire(); + this.FadeOut(800) + .Expire(); + } } public Drawable ProxiedLayer => initialCircle.ApproachCircle; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 28fbf46a92..4220299a25 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -62,14 +62,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime); - ScaleTo(0.5f); - ScaleTo(1.2f, animIn); - FadeIn(animIn); - - Delay(animIn); - ScaleTo(1, 150, EasingTypes.Out); - - Delay(-animIn); + this.Animate( + d => d.FadeIn(animIn), + d => d.ScaleTo(0.5f).ScaleTo(1.2f, animIn) + ).Then( + d => d.ScaleTo(1, 150, EasingTypes.Out) + ); } protected override void UpdateCurrentState(ArmedState state) @@ -77,16 +75,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables switch (state) { case ArmedState.Idle: - Delay(FadeOutTime - sliderTick.StartTime); - FadeOut(); + this.Delay(FadeOutTime - sliderTick.StartTime).FadeOut(); break; case ArmedState.Miss: - FadeOut(160); - FadeColour(Color4.Red, 80); + this.FadeOut(160) + .FadeColour(Color4.Red, 80); break; case ArmedState.Hit: - FadeOut(120, EasingTypes.OutQuint); - ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint); + this.FadeOut(120, EasingTypes.OutQuint) + .ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint); break; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 840acb8221..c7d838e517 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -189,30 +189,28 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables disc.RotateTo(-720); symbol.RotateTo(-720); - mainContainer.ScaleTo(0); - mainContainer.ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint); - - mainContainer.Delay(TIME_PREEMPT - 150); - mainContainer.ScaleTo(1, 500, EasingTypes.OutQuint); + mainContainer + .ScaleTo(0) + .ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint) + .Then() + .ScaleTo(1, 500, EasingTypes.OutQuint); } protected override void UpdateCurrentState(ArmedState state) { - Delay(spinner.Duration, true); - - FadeOut(160); + var sequence = this.Delay(spinner.Duration).FadeOut(160); switch (state) { case ArmedState.Hit: - ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); - Expire(); + sequence.ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); break; case ArmedState.Miss: - ScaleTo(Scale * 0.8f, 320, EasingTypes.In); - Expire(); + sequence.ScaleTo(Scale * 0.8f, 320, EasingTypes.In); break; } + + Expire(); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs index a34ff30a43..10d14b5485 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs @@ -37,8 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override void LoadComplete() { base.LoadComplete(); - using (icon.BeginLoopedSequence()) - icon.RotateTo(360, 1000); + icon.Spin(1000, RotationDirection.Clockwise); } public void UpdateProgress(double progress, int repeat) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index f3ddf683d2..98b243b375 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -4,7 +4,6 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; @@ -127,13 +126,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces if (Complete && updateCompleteTick()) { - background.Flush(flushType: typeof(TransformAlpha)); - background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo); - background.Delay(60); - background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); + background.FinishTransforms(false, nameof(Alpha)); + background + .FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo) + .Then() + .FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); } - RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo); + this.RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index 5d627f2b50..7507ee600e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -64,11 +64,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void LoadComplete() { base.LoadComplete(); - Delay(BarLine.StartTime - Time.Current); - 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) => MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime)); + private void updateScrollPosition(double time) => this.MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime)); protected override void Update() { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index a4a46e3b48..1d614b4adb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -65,45 +65,42 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { - Delay(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true); - var circlePiece = MainPiece as CirclePiece; + circlePiece?.FlashBox.FinishTransforms(); - circlePiece?.FlashBox.Flush(); - - switch (State) + using (BeginDelayedSequence(HitObject.StartTime - Time.Current + Judgement.TimeOffset, true)) { - case ArmedState.Idle: - Delay(HitObject.HitWindowMiss); - break; - case ArmedState.Miss: - FadeOut(100); - break; - case ArmedState.Hit: - 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); - 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); - - MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); - Delay(gravity_time, true); - 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 1c72f2a7dd..521d225abe 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -147,9 +147,10 @@ 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); - using (expandingRing.BeginDelayedSequence(50)) - expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); + expandingRing + .FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50) + .Then() + .FadeTo(completion / 8, 2000, EasingTypes.OutQuint); symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint); @@ -180,26 +181,21 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { const float preempt = 100; - - Delay(HitObject.StartTime - Time.Current - preempt, true); - - targetRing.ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); - - Delay(preempt, true); - - Delay(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; } - FadeOut(out_transition_time, EasingTypes.Out); - Expire(); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 3f8249f5a9..a4cd026e4c 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -166,9 +166,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces double duration = timingPoint.BeatLength * 2; - background.FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint); - using (background.BeginDelayedSequence(pre_beat_transition_time)) - background.FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); + background + .FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint) + .Then() + .FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint); } } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index 08fd8dbecc..779471b8dc 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -6,6 +6,7 @@ using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; +using osu.Framework.Graphics; namespace osu.Game.Rulesets.Taiko.UI { @@ -47,7 +48,7 @@ namespace osu.Game.Rulesets.Taiko.UI switch (Judgement.Result) { case HitResult.Hit: - MoveToY(-100, 500); + this.MoveToY(-100, 500); break; } diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index 4d39ba0ead..8766f7b9f5 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -62,8 +62,8 @@ namespace osu.Game.Rulesets.Taiko.UI { base.LoadComplete(); - ScaleTo(3f, 1000, EasingTypes.OutQuint); - FadeOut(500); + this.ScaleTo(3f, 1000, EasingTypes.OutQuint); + this.FadeOut(500); Expire(); } @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// public void VisualiseSecondHit() { - ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), 50); + this.ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), 50); } } } diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 999d76ab0b..a413d77d16 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -149,15 +149,17 @@ namespace osu.Game.Rulesets.Taiko.UI const float down_time = 40; const float up_time = 1000; - back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); - back.Delay(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.Delay(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; diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs index b4aec7057b..346f435e5d 100644 --- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -59,8 +59,8 @@ namespace osu.Game.Rulesets.Taiko.UI { base.LoadComplete(); - ScaleTo(new Vector2(1, 3f), 500, EasingTypes.OutQuint); - FadeOut(250); + this.ScaleTo(new Vector2(1, 3f), 500, EasingTypes.OutQuint); + this.FadeOut(250); Expire(); } diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index e467df0c53..24970b8dab 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -12,6 +12,7 @@ using osu.Framework.Desktop.Platform; using osu.Framework.Platform; using osu.Game.Database; using osu.Game.IPC; +using osu.Framework.Allocation; namespace osu.Game.Tests.Beatmaps.IO { @@ -26,15 +27,15 @@ namespace osu.Game.Tests.Beatmaps.IO //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new HeadlessGameHost()) { - loadOsu(host); + var osu = loadOsu(host); var temp = prepareTempCopy(osz_path); Assert.IsTrue(File.Exists(temp)); - host.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); - ensureLoaded(host); + ensureLoaded(osu); Assert.IsFalse(File.Exists(temp)); } @@ -49,7 +50,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(host.IsPrimaryInstance); Assert.IsTrue(!client.IsPrimaryInstance); - loadOsu(host); + var osu = loadOsu(host); var temp = prepareTempCopy(osz_path); @@ -59,7 +60,7 @@ namespace osu.Game.Tests.Beatmaps.IO if (!importer.ImportAsync(temp).Wait(10000)) Assert.Fail(@"IPC took too long to send"); - ensureLoaded(host); + ensureLoaded(osu); Assert.IsFalse(File.Exists(temp)); } @@ -71,16 +72,16 @@ namespace osu.Game.Tests.Beatmaps.IO //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new HeadlessGameHost()) { - loadOsu(host); + var osu = loadOsu(host); var temp = prepareTempCopy(osz_path); Assert.IsTrue(File.Exists(temp), "Temporary file copy never substantiated"); using (File.OpenRead(temp)) - host.Dependencies.Get().Import(temp); + osu.Dependencies.Get().Import(temp); - ensureLoaded(host); + ensureLoaded(osu); File.Delete(temp); @@ -103,19 +104,19 @@ namespace osu.Game.Tests.Beatmaps.IO Thread.Sleep(1); //reset beatmap database (sqlite and storage backing) - host.Dependencies.Get().Reset(); - host.Dependencies.Get().Reset(); + osu.Dependencies.Get().Reset(); + osu.Dependencies.Get().Reset(); return osu; } - private void ensureLoaded(GameHost host, int timeout = 60000) + private void ensureLoaded(OsuGameBase osu, int timeout = 60000) { IEnumerable resultSets = null; Action waitAction = () => { - while (!(resultSets = host.Dependencies.Get() + while (!(resultSets = osu.Dependencies.Get() .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) Thread.Sleep(50); }; @@ -132,7 +133,7 @@ namespace osu.Game.Tests.Beatmaps.IO //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitAction = () => { - while ((resultBeatmaps = host.Dependencies.Get() + while ((resultBeatmaps = osu.Dependencies.Get() .GetAllWithChildren(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) Thread.Sleep(50); }; @@ -140,7 +141,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), @"Beatmaps did not import to the database in allocated time"); - var set = host.Dependencies.Get().GetChildren(resultSets.First()); + var set = osu.Dependencies.Get().GetChildren(resultSets.First()); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); @@ -150,16 +151,16 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; + var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } } diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 3dac50732c..10eeba53e0 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -64,9 +64,9 @@ namespace osu.Game.Beatmaps.Drawables } if (state == PanelSelectedState.Hidden) - FadeOut(300, EasingTypes.OutQuint); + this.FadeOut(300, EasingTypes.OutQuint); else - FadeIn(250); + this.FadeIn(250); } private PanelSelectedState state = PanelSelectedState.NotSelected; diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 44d176f4d9..d3d01a5bc8 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -83,16 +83,10 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { instantMovement |= !IsPresent; - - ClearTransforms(); - FadeIn(500, EasingTypes.OutQuint); + this.FadeIn(500, EasingTypes.OutQuint); } - protected override void PopOut() - { - using (BeginDelayedSequence(150)) - FadeOut(500, EasingTypes.OutQuint); - } + protected override void PopOut() => this.Delay(150).FadeOut(500, EasingTypes.OutQuint); public override void Move(Vector2 pos) { @@ -103,7 +97,7 @@ namespace osu.Game.Graphics.Cursor } else { - MoveTo(pos, 200, EasingTypes.OutQuint); + this.MoveTo(pos, 200, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index 9eb66d8fac..0edd2c3ac4 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -4,7 +4,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics.Transforms; namespace osu.Game.Graphics { @@ -27,10 +26,8 @@ namespace osu.Game.Graphics /// The new accent colour. /// The tween duration. /// The tween easing. - public static void FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) - where T : Transformable, IHasAccentColour - { - accentedDrawable.TransformTo(newColour, duration, easing, new TransformAccent()); - } + public static TransformSequence FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) + where T : IHasAccentColour + => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); } } diff --git a/osu.Game/Graphics/Transforms/TransformAccent.cs b/osu.Game/Graphics/Transforms/TransformAccent.cs deleted file mode 100644 index 53a452ad8a..0000000000 --- a/osu.Game/Graphics/Transforms/TransformAccent.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; - -namespace osu.Game.Graphics.Transforms -{ - public class TransformAccent : Transform - { - /// - /// Current value of the transformed colour in linear colour space. - /// - public virtual Color4 CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((IHasAccentColour)d).AccentColour = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((IHasAccentColour)d).AccentColour; - } -} diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 155b08fde8..e69f9e3f42 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -54,13 +54,13 @@ namespace osu.Game.Graphics.UserInterface if (State == Visibility.Visible) { - FadeIn(transition_duration, EasingTypes.OutQuint); - ScaleTo(new Vector2(1f), transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); + this.ScaleTo(new Vector2(1f), transition_duration, EasingTypes.OutQuint); } else { - FadeOut(transition_duration, EasingTypes.OutQuint); - ScaleTo(new Vector2(0.8f, 1f), transition_duration, EasingTypes.OutQuint); + this.FadeOut(transition_duration, EasingTypes.OutQuint); + this.ScaleTo(new Vector2(0.8f, 1f), transition_duration, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 3f1b81893d..460f4cea41 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -99,8 +99,7 @@ namespace osu.Game.Graphics.UserInterface colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); flash(); - Delay(click_duration); - Schedule(delegate { + this.Delay(click_duration).Schedule(delegate { colourContainer.ResizeTo(new Vector2(0.8f, 1f)); spriteText.Spacing = Vector2.Zero; glowContainer.FadeOut(); diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index eed5061abd..4f348ebb56 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -34,14 +34,13 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - using (spinner.BeginLoopedSequence()) - spinner.RotateTo(360, 2000); + spinner.Spin(2000, RotationDirection.Clockwise); } private const float transition_duration = 500; - protected override void PopIn() => FadeIn(transition_duration * 5, EasingTypes.OutQuint); + protected override void PopIn() => this.FadeIn(transition_duration * 5, EasingTypes.OutQuint); - protected override void PopOut() => FadeOut(transition_duration, EasingTypes.OutQuint); + protected override void PopOut() => this.FadeOut(transition_duration, EasingTypes.OutQuint); } } diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index d5059945c6..298badcb77 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -80,13 +80,13 @@ namespace osu.Game.Graphics.UserInterface if (value) { - FadeColour(GlowingAccentColour, 500, EasingTypes.OutQuint); + this.FadeColour(GlowingAccentColour, 500, EasingTypes.OutQuint); FadeEdgeEffectTo(1, 500, EasingTypes.OutQuint); } else { FadeEdgeEffectTo(0, 500); - FadeColour(AccentColour, 500); + this.FadeColour(AccentColour, 500); } } } @@ -95,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface { set { - ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, EasingTypes.OutQuint); } } diff --git a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs index e17ce2a5b2..66c214f6a3 100644 --- a/osu.Game/Graphics/UserInterface/OsuContextMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuContextMenu.cs @@ -39,13 +39,13 @@ namespace osu.Game.Graphics.UserInterface Background.Colour = colours.ContextMenuGray; } - protected override void AnimateOpen() => FadeIn(fade_duration, EasingTypes.OutQuint); - protected override void AnimateClose() => FadeOut(fade_duration, EasingTypes.OutQuint); + protected override void AnimateOpen() => this.FadeIn(fade_duration, EasingTypes.OutQuint); + protected override void AnimateClose() => this.FadeOut(fade_duration, EasingTypes.OutQuint); protected override void UpdateContentHeight() { var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; - ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 84b88da96e..2bcf0a467c 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -19,14 +19,14 @@ namespace osu.Game.Graphics.UserInterface ItemsContainer.Padding = new MarginPadding(5); } - protected override void AnimateOpen() => FadeIn(300, EasingTypes.OutQuint); + protected override void AnimateOpen() => this.FadeIn(300, EasingTypes.OutQuint); - protected override void AnimateClose() => FadeOut(300, EasingTypes.OutQuint); + protected override void AnimateClose() => this.FadeOut(300, EasingTypes.OutQuint); protected override void UpdateContentHeight() { var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; - ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index b51dd2287b..0a402f9045 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -1,9 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; using System; namespace osu.Game.Graphics.UserInterface @@ -13,8 +10,6 @@ namespace osu.Game.Graphics.UserInterface /// public class PercentageCounter : RollingCounter { - protected override Type TransformType => typeof(TransformAccuracy); - protected override double RollingDuration => 750; private float epsilon => 1e-10f; @@ -44,23 +39,5 @@ namespace osu.Game.Graphics.UserInterface { Current.Value = Current + amount; } - - protected class TransformAccuracy : Transform - { - public virtual double CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return Interpolation.ValueAt(time, (float)StartValue, (float)EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((PercentageCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((PercentageCounter)d).DisplayedCount; - } } } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index db6e6ff44f..cb657825de 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -5,30 +5,21 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Sprites; using System; using System.Collections.Generic; -using System.Diagnostics; using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface { public abstract class RollingCounter : Container, IHasAccentColour + where T : struct, IEquatable { /// /// The current value. /// public Bindable Current = new Bindable(); - /// - /// Type of the Transform to use. - /// - /// - /// Must be a subclass of Transform(T) - /// - protected virtual Type TransformType => typeof(Transform); - protected SpriteText DisplayedCountSpriteText; /// @@ -58,7 +49,8 @@ namespace osu.Game.Graphics.UserInterface { return displayedCount; } - protected set + + set { if (EqualityComparer.Default.Equals(displayedCount, value)) return; @@ -133,7 +125,7 @@ namespace osu.Game.Graphics.UserInterface /// public virtual void StopRolling() { - Flush(false, TransformType); + FinishTransforms(false, nameof(DisplayedCount)); DisplayedCount = Current; } @@ -176,44 +168,15 @@ namespace osu.Game.Graphics.UserInterface /// implement the rollover animation). /// /// Count value before modification. - /// Expected count value after modification- - /// + /// Expected count value after modification. protected virtual void TransformCount(T currentValue, T newValue) { - Debug.Assert( - typeof(Transform).IsAssignableFrom(TransformType), - @"transformType should be a subclass of Transform." - ); - - TransformCount((Transform)Activator.CreateInstance(TransformType), currentValue, newValue); - } - - /// - /// Intended to be used by TransformCount(T currentValue, T newValue). - /// - protected void TransformCount(Transform transform, T currentValue, T newValue) - { - Type type = transform.GetType(); - - Flush(false, type); - - if (RollingDuration < 1) - { - DisplayedCount = Current; - return; - } - double rollingTotalDuration = IsRollingProportional ? GetProportionalDuration(currentValue, newValue) : RollingDuration; - transform.StartTime = TransformStartTime; - transform.EndTime = TransformStartTime + rollingTotalDuration; - transform.EndValue = newValue; - transform.Easing = RollingEasing; - - Transforms.Add(transform); + this.TransformTo(nameof(DisplayedCount), newValue, rollingTotalDuration, RollingEasing); } } } diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 6fe43e1fcc..a1fa48e3cd 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -2,16 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; -using System; namespace osu.Game.Graphics.UserInterface { public class ScoreCounter : RollingCounter { - protected override Type TransformType => typeof(TransformScore); - protected override double RollingDuration => 1000; protected override EasingTypes RollingEasing => EasingTypes.Out; @@ -55,23 +50,5 @@ namespace osu.Game.Graphics.UserInterface { Current.Value = Current + amount; } - - protected class TransformScore : Transform - { - public virtual double CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return Interpolation.ValueAt(time, (float)StartValue, (float)EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((ScoreCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScoreCounter)d).DisplayedCount; - } } } diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs index 7664eeee40..211de72efc 100644 --- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -2,9 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; namespace osu.Game.Graphics.UserInterface { @@ -13,8 +10,6 @@ namespace osu.Game.Graphics.UserInterface /// public class SimpleComboCounter : RollingCounter { - protected override Type TransformType => typeof(TransformCounterCount); - protected override double RollingDuration => 750; public SimpleComboCounter() @@ -36,23 +31,5 @@ namespace osu.Game.Graphics.UserInterface { Current.Value = Current + amount; } - - private class TransformCounterCount : Transform - { - public int CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((SimpleComboCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((SimpleComboCounter)d).DisplayedCount; - } } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 490ea6e64a..c4f98dcbb7 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -122,7 +122,7 @@ namespace osu.Game.Graphics.UserInterface if (value <= i) return minStarScale; - return i + 1 <= value ? 1.0f : (float)Interpolation.ValueAt(value, minStarScale, 1.0f, i, i + 1); + return i + 1 <= value ? 1.0f : Interpolation.ValueAt(value, minStarScale, 1.0f, i, i + 1); } private void transformCount(float newValue) @@ -133,12 +133,8 @@ namespace osu.Game.Graphics.UserInterface star.ClearTransforms(true); var delay = (countStars <= newValue ? Math.Max(i - countStars, 0) : Math.Max(countStars - 1 - i, 0)) * animationDelay; - - using (BeginDelayedSequence(delay, true)) - { - star.FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); - star.Icon.ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); - } + star.Delay(delay).FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); + star.Icon.Delay(delay).ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); i++; } diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 7f2bbb8f9f..b763cd7971 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { - ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic); + this.ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic); IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic); bouncingIcon.ScaleTo(1.1f, transform_time, EasingTypes.OutElastic); @@ -183,7 +183,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnHoverLost(InputState state) { - ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic); + this.ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic); IconLayer.FadeColour(TextLayer.Colour, transform_time, EasingTypes.OutElastic); bouncingIcon.ScaleTo(1, transform_time, EasingTypes.OutElastic); @@ -245,9 +245,9 @@ namespace osu.Game.Graphics.UserInterface if (beatIndex < 0) return; - icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, EasingTypes.Out); - using (icon.BeginDelayedSequence(beat_in_time)) - icon.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + icon.ScaleTo(1 - 0.1f * amplitudeAdjust, beat_in_time, EasingTypes.Out) + .Then() + .ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); } } } diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index a758d5fdef..fa192b0825 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -93,21 +93,20 @@ namespace osu.Game.Graphics.UserInterface.Volume protected override void PopIn() { ClearTransforms(); - FadeIn(100); + this.FadeIn(100); schedulePopOut(); } protected override void PopOut() { - FadeOut(100); + this.FadeOut(100); } private void schedulePopOut() { popOutDelegate?.Cancel(); - Delay(1000); - popOutDelegate = Schedule(Hide); + this.Delay(1000).Schedule(Hide, out popOutDelegate); } } } \ No newline at end of file diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4e99a44a07..881ee891c1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -80,6 +80,11 @@ namespace osu.Game public void ToggleDirect() => direct.ToggleVisibility(); + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig) { @@ -97,7 +102,7 @@ namespace osu.Game Task.Run(() => BeatmapDatabase.Import(paths.ToArray())); } - Dependencies.Cache(this); + dependencies.Cache(this); configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value); @@ -121,8 +126,7 @@ namespace osu.Game if (!menu.IsCurrentScreen) { menu.MakeCurrent(); - Delay(500); - scoreLoad = Schedule(() => LoadScore(s)); + this.Delay(500).Schedule(() => LoadScore(s), out scoreLoad); return; } @@ -207,13 +211,13 @@ namespace osu.Game }); }; - Dependencies.Cache(settings); - Dependencies.Cache(social); - Dependencies.Cache(chat); - Dependencies.Cache(userProfile); - Dependencies.Cache(musicController); - Dependencies.Cache(notificationManager); - Dependencies.Cache(dialogOverlay); + dependencies.Cache(settings); + dependencies.Cache(social); + dependencies.Cache(chat); + dependencies.Cache(userProfile); + dependencies.Cache(musicController); + dependencies.Cache(notificationManager); + dependencies.Cache(dialogOverlay); // ensure both overlays aren't presented at the same time chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7a2d91d733..27ad4f20f9 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -81,21 +81,26 @@ namespace osu.Game Name = @"osu!lazer"; } + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + [BackgroundDependencyLoader] private void load() { - Dependencies.Cache(this); - Dependencies.Cache(LocalConfig); + dependencies.Cache(this); + dependencies.Cache(LocalConfig); SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); - Dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); - Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host)); - Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); - Dependencies.Cache(new OsuColour()); + dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); + dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host)); + dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); + dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. - Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true); + dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); @@ -127,7 +132,7 @@ namespace osu.Game OszArchiveReader.Register(); - Dependencies.Cache(API = new APIAccess + dependencies.Cache(API = new APIAccess { Username = LocalConfig.Get(OsuSetting.Username), Token = LocalConfig.Get(OsuSetting.Token) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index aca65bbc17..7b11ba2de0 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Chat { set { - FadeTo(value ? 1f : 0f, 100); + this.FadeTo(value ? 1f : 0f, 100); } } @@ -175,14 +175,14 @@ namespace osu.Game.Overlays.Chat joinedCheckmark.FadeTo(1f, transition_duration); topic.FadeTo(0.8f, transition_duration); topic.FadeColour(Color4.White, transition_duration); - FadeColour(joinedColour, transition_duration); + this.FadeColour(joinedColour, transition_duration); } else { joinedCheckmark.FadeTo(0f, transition_duration); topic.FadeTo(1f, transition_duration); topic.FadeColour(topicColour, transition_duration); - FadeColour(Color4.White, transition_duration); + this.FadeColour(Color4.White, transition_duration); } } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index cafb88b6ac..1f046aff2a 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Chat { set { - FadeTo(value ? 1f : 0f, 100); + this.FadeTo(value ? 1f : 0f, 100); } } diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 135f8f43b9..380275475b 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -158,10 +158,10 @@ namespace osu.Game.Overlays.Chat protected override void PopIn() { - if (Alpha == 0) MoveToY(DrawHeight); + if (Alpha == 0) this.MoveToY(DrawHeight); - FadeIn(transition_duration, EasingTypes.OutQuint); - MoveToY(0, transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); + this.MoveToY(0, transition_duration, EasingTypes.OutQuint); search.HoldFocus = true; base.PopIn(); @@ -169,8 +169,8 @@ namespace osu.Game.Overlays.Chat protected override void PopOut() { - FadeOut(transition_duration, EasingTypes.InSine); - MoveToY(DrawHeight, transition_duration, EasingTypes.InSine); + this.FadeOut(transition_duration, EasingTypes.InSine); + this.MoveToY(DrawHeight, transition_duration, EasingTypes.InSine); search.HoldFocus = false; base.PopOut(); diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 92147db57f..cb85bdb0c9 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Chat private void fadeActive() { - ResizeTo(new Vector2(Width, 1.1f), transition_length, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(Width, 1.1f), transition_length, EasingTypes.OutQuint); box.FadeColour(backgroundActive, transition_length, EasingTypes.OutQuint); highlightBox.FadeIn(transition_length, EasingTypes.OutQuint); @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Chat private void fadeInactive() { - ResizeTo(new Vector2(Width, 1), transition_length, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(Width, 1), transition_length, EasingTypes.OutQuint); box.FadeColour(backgroundInactive, transition_length, EasingTypes.OutQuint); highlightBox.FadeOut(transition_length, EasingTypes.OutQuint); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 1f9f7e57ca..fd1e78e801 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -235,8 +235,8 @@ namespace osu.Game.Overlays protected override void PopIn() { - MoveToY(0, transition_length, EasingTypes.OutQuint); - FadeIn(transition_length, EasingTypes.OutQuint); + this.MoveToY(0, transition_length, EasingTypes.OutQuint); + this.FadeIn(transition_length, EasingTypes.OutQuint); inputTextBox.HoldFocus = true; base.PopIn(); @@ -244,8 +244,8 @@ namespace osu.Game.Overlays protected override void PopOut() { - MoveToY(Height, transition_length, EasingTypes.InSine); - FadeOut(transition_length, EasingTypes.InSine); + this.MoveToY(Height, transition_length, EasingTypes.InSine); + this.FadeOut(transition_length, EasingTypes.InSine); inputTextBox.HoldFocus = false; base.PopOut(); diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index f1a6bc1681..b384e110f9 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -35,8 +35,7 @@ namespace osu.Game.Overlays if (v != Visibility.Hidden) return; //handle the dialog being dismissed. - dialog.Delay(PopupDialog.EXIT_DURATION); - dialog.Expire(); + dialog.Delay(PopupDialog.EXIT_DURATION).Expire(); if (dialog == currentDialog) State = Visibility.Hidden; @@ -45,13 +44,13 @@ namespace osu.Game.Overlays protected override void PopIn() { base.PopIn(); - FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint); + this.FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint); } protected override void PopOut() { base.PopOut(); - FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine); + this.FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine); } public DialogOverlay() diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 3c464af05d..cc7d57e04b 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - FadeInFromZero(200, EasingTypes.Out); + this.FadeInFromZero(200, EasingTypes.Out); bottomPanel.LayoutDuration = 200; bottomPanel.LayoutEasing = EasingTypes.Out; bottomPanel.Origin = Anchor.BottomLeft; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index f693998563..1b36798639 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - FadeInFromZero(200, EasingTypes.Out); + this.FadeInFromZero(200, EasingTypes.Out); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index d9d5a44fd5..0f53fb2d5c 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays base.PopIn(); settingsSection.Bounding = true; - FadeIn(transition_time, EasingTypes.OutQuint); + this.FadeIn(transition_time, EasingTypes.OutQuint); InputManager.ChangeFocus(settingsSection); } @@ -77,7 +77,7 @@ namespace osu.Game.Overlays base.PopOut(); settingsSection.Bounding = false; - FadeOut(transition_time); + this.FadeOut(transition_time); } } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 5f85474ede..6e9ad3fafe 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -194,38 +194,43 @@ namespace osu.Game.Overlays { base.PopIn(); - FadeIn(200); + this.FadeIn(200); background.FlashColour(Color4.White.Opacity(0.25f), 400); getSample.Play(); - using (innerSpin.BeginLoopedSequence()) - innerSpin.RotateTo(360, 20000); - - using (outerSpin.BeginLoopedSequence()) - outerSpin.RotateTo(360, 40000); + innerSpin.Spin(20000, RotationDirection.Clockwise); + outerSpin.Spin(40000, RotationDirection.Clockwise); using (BeginDelayedSequence(200, true)) { - disc.FadeIn(initial_duration); + disc.FadeIn(initial_duration) + .ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); + particleContainer.FadeIn(initial_duration); outerSpin.FadeTo(0.1f, initial_duration * 2); - disc.ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); using (BeginDelayedSequence(initial_duration + 200, true)) { backgroundStrip.FadeIn(step_duration); leftStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); rightStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); - Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Icon; }); - using (BeginDelayedSequence(step_duration, true)) + this.Animate().Schedule(() => { - Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.MedalUnlocked; }); - - using (BeginDelayedSequence(step_duration, true)) - Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Full; }); - } + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Icon; + }) + .Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.MedalUnlocked; + }) + .Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Full; + }); } } } @@ -233,7 +238,7 @@ namespace osu.Game.Overlays protected override void PopOut() { base.PopOut(); - FadeOut(200); + this.FadeOut(200); } private void dismiss() @@ -242,7 +247,7 @@ namespace osu.Game.Overlays { // if we haven't yet, play out the animation fully drawableMedal.State = DisplayState.Full; - Flush(true); + FinishTransforms(true); return; } @@ -295,8 +300,8 @@ namespace osu.Game.Overlays Radius = 5, }; - MoveTo(positionForOffset(DISC_SIZE / 2 + 200), 500); - FadeOut(500); + this.MoveTo(positionForOffset(DISC_SIZE / 2 + 200), 500); + this.FadeOut(500); Expire(); } } diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 7d7ffbd12a..89e991f5ef 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -147,23 +147,26 @@ namespace osu.Game.Overlays.MedalSplash medalContainer.ScaleTo(0); break; case DisplayState.Icon: - medalContainer.ScaleTo(1, duration, EasingTypes.OutElastic); - medalContainer.FadeIn(duration); + medalContainer + .FadeIn(duration) + .ScaleTo(1, duration, EasingTypes.OutElastic); break; case DisplayState.MedalUnlocked: - medalContainer.ScaleTo(1); - medalContainer.Show(); + medalContainer + .FadeTo(1) + .ScaleTo(1); - ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); - MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); + this.ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); + this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); unlocked.FadeInFromZero(duration); break; case DisplayState.Full: - medalContainer.ScaleTo(1); - medalContainer.Show(); + medalContainer + .FadeTo(1) + .ScaleTo(1); - ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); - MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); + this.ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); + this.MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); name.FadeInFromZero(duration + 100); description.FadeInFromZero(duration * 2); break; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index aca73d2828..bea0aae57e 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -81,11 +81,13 @@ namespace osu.Game.Overlays.Mods backgroundIcon.Icon = modAfter.Icon; using (BeginDelayedSequence(mod_switch_duration, true)) { - foregroundIcon.RotateTo(-rotate_angle * direction); - foregroundIcon.RotateTo(0f, mod_switch_duration, mod_switch_easing); + foregroundIcon + .RotateTo(-rotate_angle * direction) + .RotateTo(0f, mod_switch_duration, mod_switch_easing); - backgroundIcon.RotateTo(rotate_angle * direction); - backgroundIcon.RotateTo(0f, mod_switch_duration, mod_switch_easing); + backgroundIcon + .RotateTo(rotate_angle * direction) + .RotateTo(0f, mod_switch_duration, mod_switch_easing); Schedule(() => displayMod(modAfter)); } diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 0a095327b0..128dddbce5 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Music if (value == selected) return; selected = value; - Flush(true); + FinishTransforms(true); foreach (SpriteText s in titleSprites) s.FadeColour(Selected ? hoverColour : Color4.White, fade_duration); } @@ -145,7 +145,7 @@ namespace osu.Game.Overlays.Music matching = value; - FadeTo(matching ? 1 : 0, 200); + this.FadeTo(matching ? 1 : 0, 200); } } } diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 1e4c3c5ff6..d6a69c1a80 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -101,16 +101,16 @@ namespace osu.Game.Overlays.Music filter.Search.HoldFocus = true; Schedule(() => inputManager.ChangeFocus(filter.Search)); - ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); - FadeIn(transition_duration, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); } protected override void PopOut() { filter.Search.HoldFocus = false; - ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); - FadeOut(transition_duration); + this.ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); + this.FadeOut(transition_duration); } private void itemSelected(BeatmapSetInfo set) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 0da425652a..9d726b3952 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -368,7 +368,7 @@ namespace osu.Game.Overlays { base.PopIn(); - FadeIn(transition_length, EasingTypes.OutQuint); + this.FadeIn(transition_length, EasingTypes.OutQuint); dragContainer.ScaleTo(1, transition_length, EasingTypes.OutElastic); } @@ -376,7 +376,7 @@ namespace osu.Game.Overlays { base.PopOut(); - FadeOut(transition_length, EasingTypes.OutQuint); + this.FadeOut(transition_length, EasingTypes.OutQuint); dragContainer.ScaleTo(0.9f, transition_length, EasingTypes.OutQuint); } diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 18cb49f335..f83aeb1275 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -90,8 +90,8 @@ namespace osu.Game.Overlays base.PopIn(); scrollContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(1, TRANSITION_LENGTH / 2); + this.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); + this.FadeTo(1, TRANSITION_LENGTH / 2); } private void markAllRead() @@ -105,8 +105,8 @@ namespace osu.Game.Overlays markAllRead(); - MoveToX(width, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(0, TRANSITION_LENGTH / 2); + this.MoveToX(width, TRANSITION_LENGTH, EasingTypes.OutQuint); + this.FadeTo(0, TRANSITION_LENGTH / 2); } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index f5613d6656..4337989a13 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.Notifications protected override void LoadComplete() { base.LoadComplete(); - FadeInFromZero(200); + this.FadeInFromZero(200); NotificationContent.MoveToX(DrawSize.X); NotificationContent.MoveToX(0, 500, EasingTypes.OutQuint); } @@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Notifications wasClosed = true; Closed?.Invoke(); - FadeOut(100); + this.FadeOut(100); Expire(); } @@ -181,13 +181,13 @@ namespace osu.Game.Overlays.Notifications protected override bool OnHover(InputState state) { - FadeColour(hoverColour, 200); + this.FadeColour(hoverColour, 200); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - FadeColour(OsuColour.Gray(0.2f), 200); + this.FadeColour(OsuColour.Gray(0.2f), 200); base.OnHoverLost(state); } } @@ -212,12 +212,9 @@ namespace osu.Game.Overlays.Notifications if (pulsate) { const float length = 1000; - using (pulsateLayer.BeginLoopedSequence(length / 2)) - { - pulsateLayer.FadeTo(0.4f, length, EasingTypes.In); - using (pulsateLayer.BeginDelayedSequence(length)) - pulsateLayer.FadeTo(1, length, EasingTypes.Out); - } + pulsateLayer.Loop(length / 2, + p => p.FadeTo(0.4f, length, EasingTypes.In).Then().FadeTo(1, length, EasingTypes.Out) + ); } } } diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index f0fa7e6da1..bd7b8bf844 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -78,10 +78,7 @@ namespace osu.Game.Overlays.Notifications { case ProgressNotificationState.Completed: NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint); - FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run. - - Delay(100); - Schedule(Completed); + this.FadeOut(200).Finally(d => Completed()); break; } } @@ -196,7 +193,7 @@ namespace osu.Game.Overlays.Notifications set { active = value; - FadeColour(active ? colourActive : colourInactive, 100); + this.FadeColour(active ? colourActive : colourInactive, 100); } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 464c9893d1..65bef22295 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -154,14 +154,13 @@ namespace osu.Game.Overlays textLine2.Text = settingValue; textLine3.Text = shortcut.ToUpper(); - box.FadeIn(500, EasingTypes.OutQuint); - box.ResizeHeightTo(height, 500, EasingTypes.OutQuint); - - using (box.BeginDelayedSequence(500)) - { - box.FadeOutFromOne(1500, EasingTypes.InQuint); - box.ResizeHeightTo(height_contracted, 1500, EasingTypes.InQuint); - } + box.Animate( + b => b.FadeIn(500, EasingTypes.OutQuint), + b => b.ResizeHeightTo(height, 500, EasingTypes.OutQuint) + ).Then( + b => b.FadeOutFromOne(1500, EasingTypes.InQuint), + b => b.ResizeHeightTo(height_contracted, 1500, EasingTypes.InQuint) + ); int optionCount = 0; int selectedOption = -1; @@ -261,7 +260,7 @@ namespace osu.Game.Overlays }; updateGlow(); - Flush(true); + FinishTransforms(true); } } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 21bfd5afd6..aa57816701 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -517,13 +517,13 @@ namespace osu.Game.Overlays.Profile protected override bool OnHover(InputState state) { - FadeColour(hoverColour, 500, EasingTypes.OutQuint); + this.FadeColour(hoverColour, 500, EasingTypes.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - FadeColour(Color4.White, 500, EasingTypes.OutQuint); + this.FadeColour(Color4.White, 500, EasingTypes.OutQuint); base.OnHoverLost(state); } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index f80fef4a99..c74f4070e7 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Settings set { // probably needs a better transition. - FadeTo(value ? 1 : 0); + this.FadeTo(value ? 1 : 0); } } diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 77bf87f718..68ebde6b28 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Settings { set { - FadeTo(value ? 1 : 0); + this.FadeTo(value ? 1 : 0); } } diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 0a9f7ba5d0..ac6d2fa239 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings { set { - FadeTo(value ? 1 : 0); + this.FadeTo(value ? 1 : 0); } } diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 44d296a079..f5ab3b301b 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -94,10 +94,10 @@ namespace osu.Game.Overlays.Settings switch (state) { default: - ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); break; case ExpandedState.Expanded: - ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); + this.ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); break; } } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 86e1c1069c..1fdab08112 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -127,7 +127,7 @@ namespace osu.Game.Overlays sectionsContainer.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); sidebar.MoveToX(0, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(1, TRANSITION_LENGTH / 2); + this.FadeTo(1, TRANSITION_LENGTH / 2); searchTextBox.HoldFocus = true; } @@ -138,7 +138,7 @@ namespace osu.Game.Overlays sectionsContainer.MoveToX(-width, TRANSITION_LENGTH, EasingTypes.OutQuint); sidebar.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, EasingTypes.OutQuint); - FadeTo(0, TRANSITION_LENGTH / 2); + this.FadeTo(0, TRANSITION_LENGTH / 2); searchTextBox.HoldFocus = false; if (searchTextBox.HasFocus) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index a7e5f8dcc4..9070bc45ad 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -121,16 +121,16 @@ namespace osu.Game.Overlays.Toolbar protected override void PopIn() { - MoveToY(0, transition_time, EasingTypes.OutQuint); - FadeIn(transition_time / 2, EasingTypes.OutQuint); + this.MoveToY(0, transition_time, EasingTypes.OutQuint); + this.FadeIn(transition_time / 2, EasingTypes.OutQuint); } protected override void PopOut() { userArea?.LoginOverlay.Hide(); - MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint); - FadeOut(transition_time); + this.MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint); + this.FadeOut(transition_time); } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 95906464ec..3ecf0fd83c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleInput => !ruleset.Disabled; - private void disabledChanged(bool isDisabled) => FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); + private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); protected override void Update() { diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 1bb7813d90..ce587c9ed2 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -137,23 +137,23 @@ namespace osu.Game.Overlays foreach (var w in wavesContainer.Children) w.State = Visibility.Visible; - FadeIn(100, EasingTypes.OutQuint); + this.FadeIn(100, EasingTypes.OutQuint); contentContainer.MoveToY(0, APPEAR_DURATION, EasingTypes.OutQuint); - FadeIn(100, EasingTypes.OutQuint); + this.FadeIn(100, EasingTypes.OutQuint); } protected override void PopOut() { base.PopOut(); - FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); + this.FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In); foreach (var w in wavesContainer.Children) w.State = Visibility.Hidden; - FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); + this.FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint); } protected override void UpdateAfterChildren() @@ -210,10 +210,10 @@ namespace osu.Game.Overlays switch (value) { case Visibility.Hidden: - MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide); + this.MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide); break; case Visibility.Visible: - MoveToY(FinalPosition, APPEAR_DURATION, easing_show); + this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show); break; } } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 3a82827497..ac8a8e2005 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -64,26 +64,24 @@ namespace osu.Game.Rulesets.Judgements { base.LoadComplete(); - FadeInFromZero(100, EasingTypes.OutQuint); + this.FadeInFromZero(100, EasingTypes.OutQuint); switch (Judgement.Result) { case HitResult.Miss: - ScaleTo(1.6f); - ScaleTo(1, 100, EasingTypes.In); + this.ScaleTo(1.6f); + this.ScaleTo(1, 100, EasingTypes.In); - MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); - RotateTo(40, 800, EasingTypes.InQuint); + this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); + this.RotateTo(40, 800, EasingTypes.InQuint); - Delay(600); - FadeOut(200); + this.Delay(600).FadeOut(200); break; case HitResult.Hit: - ScaleTo(0.9f); - ScaleTo(1, 500, EasingTypes.OutElastic); + this.ScaleTo(0.9f); + this.ScaleTo(1, 500, EasingTypes.OutElastic); - Delay(100); - FadeOut(400); + this.Delay(100).FadeOut(400); break; } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 7e2c0305a9..ac5ea04ecc 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Backgrounds if (background != null) { newDepth = background.Depth + 1; - background.Flush(); + background.FinishTransforms(); background.FadeOut(250); background.Expire(); } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7ec8347a8f..9f33d624e2 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -7,6 +7,7 @@ using OpenTK.Graphics; using osu.Framework.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Select; +using osu.Framework.Graphics; namespace osu.Game.Screens.Edit { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 8dad83bd0e..e04e3ce66b 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -130,14 +130,13 @@ namespace osu.Game.Screens.Menu icon.RotateTo(rightward ? 10 : -10, duration * 2, EasingTypes.InOutSine); - icon.MoveToY(-10, duration, EasingTypes.Out); - icon.ScaleTo(Vector2.One, duration, EasingTypes.Out); - - using (icon.BeginDelayedSequence(duration)) - { - icon.MoveToY(0, duration, EasingTypes.In); - icon.ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.In); - } + icon.Animate( + i => i.MoveToY(-10, duration, EasingTypes.Out), + i => i.ScaleTo(1, duration, EasingTypes.Out) + ).Then( + i => i.MoveToY(0, duration, EasingTypes.In), + i => i.ScaleTo(new Vector2(1, 0.9f), duration, EasingTypes.In) + ); } protected override bool OnHover(InputState state) @@ -248,23 +247,23 @@ namespace osu.Game.Screens.Menu { default: box.ScaleTo(new Vector2(0, 1), 500, EasingTypes.OutExpo); - FadeOut(500); + this.FadeOut(500); break; case 1: box.ScaleTo(new Vector2(0, 1), 400, EasingTypes.InSine); - FadeOut(800); + this.FadeOut(800); break; } break; case ButtonState.Expanded: const int expand_duration = 500; box.ScaleTo(new Vector2(1, 1), expand_duration, EasingTypes.OutExpo); - FadeIn(expand_duration / 6f); + this.FadeIn(expand_duration / 6f); break; case ButtonState.Exploded: const int explode_duration = 200; box.ScaleTo(new Vector2(2, 1), explode_duration, EasingTypes.OutExpo); - FadeOut(explode_duration / 4f * 3); + this.FadeOut(explode_duration / 4f * 3); break; } } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 24fee10195..65ba555630 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -216,7 +216,7 @@ namespace osu.Game.Screens.Menu bool fromInitial = lastState == MenuState.Initial; if (state == MenuState.TopLevel) - buttonArea.Flush(true); + buttonArea.FinishTransforms(true); using (buttonArea.BeginDelayedSequence(fromInitial ? 150 : 0, true)) { @@ -224,16 +224,13 @@ namespace osu.Game.Screens.Menu { case MenuState.Exit: case MenuState.Initial: - toolbar?.Hide(); - buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out); buttonArea.FadeOut(300); - using (osuLogo.BeginDelayedSequence(150)) - { - osuLogo.MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); - osuLogo.ScaleTo(1, 800, EasingTypes.OutExpo); - } + osuLogo.Delay(150) + .Schedule(() => toolbar?.Hide()) + .ScaleTo(1, 800, EasingTypes.OutExpo) + .MoveTo(Vector2.Zero, 800, EasingTypes.OutExpo); foreach (Button b in buttonsTopLevel) b.State = ButtonState.Contracted; @@ -252,17 +249,18 @@ namespace osu.Game.Screens.Menu case MenuState.TopLevel: buttonAreaBackground.ScaleTo(Vector2.One, 200, EasingTypes.Out); - osuLogo.ClearTransforms(); - osuLogo.MoveTo(buttonFlow.DrawPosition, 200, EasingTypes.In); - osuLogo.ScaleTo(0.5f, 200, EasingTypes.In); - - buttonArea.FadeIn(300); + var sequence = osuLogo + .ScaleTo(0.5f, 200, EasingTypes.In) + .MoveTo(buttonFlow.DrawPosition, 200, EasingTypes.In); if (fromInitial && osuLogo.Scale.X > 0.5f) - using (osuLogo.BeginDelayedSequence(200, true)) - osuLogo.Impact(); + sequence.OnComplete(o => + { + o.Impact(); + toolbar?.Show(); + }); - Scheduler.AddDelayed(() => toolbar?.Show(), 150); + buttonArea.FadeIn(300); foreach (Button b in buttonsTopLevel) b.State = ButtonState.Expanded; diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index beaaa373b6..6a176898a2 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -98,18 +98,13 @@ namespace osu.Game.Screens.Menu { base.OnEntering(last); - Content.FadeInFromZero(500); + icon.Delay(1500).FadeColour(iconColour, 200); - icon.Delay(1500); - icon.FadeColour(iconColour, 200); - - Delay(6000, true); - - Content.FadeOut(250); - - Delay(250); - - Schedule(() => Push(intro)); + Content + .FadeInFromZero(500) + .Then(5500) + .FadeOut(250) + .Finally(d => Push(intro)); } } } diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 065c7c5be0..fdacccd913 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -90,9 +90,9 @@ namespace osu.Game.Screens.Menu private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes) { - d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time); - using (d.BeginDelayedSequence(box_fade_in_time)) - d.FadeOut(beatLength, EasingTypes.In); + d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time) + .Then() + .FadeOut(beatLength, EasingTypes.In); } } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index ecfd98688e..0b05b68080 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -237,34 +237,32 @@ namespace osu.Game.Screens.Menu if (beatIndex < 0) return; if (IsHovered) - { - using (BeginDelayedSequence(early_activation)) - Schedule(() => sampleBeat.Play()); - } + this.Delay(early_activation).Schedule(() => sampleBeat.Play()); - logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out); - using (logoBeatContainer.BeginDelayedSequence(early_activation)) - logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + logoBeatContainer + .ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out) + .Then() + .ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); ripple.ClearTransforms(); - - ripple.ScaleTo(logoAmplitudeContainer.Scale); - ripple.Alpha = 0.15f * amplitudeAdjust; - - ripple.ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint); - ripple.FadeOut(beatLength, EasingTypes.OutQuint); + ripple + .ScaleTo(logoAmplitudeContainer.Scale) + .ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint) + .FadeTo(0.15f * amplitudeAdjust).FadeOut(beatLength, EasingTypes.OutQuint); if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f) { flashLayer.ClearTransforms(); - visualizer.ClearTransforms(); + flashLayer + .FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out) + .Then() + .FadeOut(beatLength); - flashLayer.FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out); - visualizer.FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out); - using (flashLayer.BeginDelayedSequence(early_activation)) - flashLayer.FadeOut(beatLength); - using (visualizer.BeginDelayedSequence(early_activation)) - visualizer.FadeTo(0.5f, beatLength); + visualizer.ClearTransforms(); + visualizer + .FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out) + .Then() + .FadeTo(0.5f, beatLength); } } diff --git a/osu.Game/Screens/Multiplayer/Match.cs b/osu.Game/Screens/Multiplayer/Match.cs index ec6a66062d..a0843bfcae 100644 --- a/osu.Game/Screens/Multiplayer/Match.cs +++ b/osu.Game/Screens/Multiplayer/Match.cs @@ -8,6 +8,7 @@ using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Game.Screens.Select; +using osu.Framework.Graphics; namespace osu.Game.Screens.Multiplayer { diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index f527eaacaf..c6b1bbcf31 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -5,8 +5,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.HUD @@ -130,7 +128,7 @@ namespace osu.Game.Screens.Play.HUD protected virtual void OnCountRolling(int currentValue, int newValue) { - transformRoll(new TransformComboRoll(), currentValue, newValue); + transformRoll(currentValue, newValue); } protected virtual void OnCountIncrement(int currentValue, int newValue) @@ -170,7 +168,7 @@ namespace osu.Game.Screens.Play.HUD if (!rolling) { - Flush(false, typeof(TransformComboRoll)); + FinishTransforms(false, nameof(DisplayedCount)); IsRolling = false; DisplayedCount = prev; @@ -186,40 +184,9 @@ namespace osu.Game.Screens.Play.HUD } } - private void transformRoll(TransformComboRoll transform, int currentValue, int newValue) + private void transformRoll(int currentValue, int newValue) { - Flush(false, typeof(TransformComboRoll)); - - if (RollingDuration < 1) - { - DisplayedCount = Current; - return; - } - - transform.StartTime = Time.Current; - transform.EndTime = Time.Current + getProportionalDuration(currentValue, newValue); - transform.EndValue = newValue; - transform.Easing = RollingEasing; - - Transforms.Add(transform); - } - - protected class TransformComboRoll : Transform - { - public virtual int CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((ComboCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ComboCounter)d).DisplayedCount; + this.TransformTo(nameof(DisplayedCount), newValue, getProportionalDuration(currentValue, newValue), RollingEasing); } protected abstract void OnDisplayedCountRolling(int currentValue, int newValue); diff --git a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs index c280702390..1686b6174d 100644 --- a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs @@ -1,10 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Framework.MathUtils; using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play.HUD @@ -12,44 +9,24 @@ namespace osu.Game.Screens.Play.HUD /// /// Used to display combo with a roll-up animation in results screen. /// - public class ComboResultCounter : RollingCounter + public class ComboResultCounter : RollingCounter { - protected override Type TransformType => typeof(TransformComboResult); - protected override double RollingDuration => 500; protected override EasingTypes RollingEasing => EasingTypes.Out; - protected override double GetProportionalDuration(ulong currentValue, ulong newValue) + protected override double GetProportionalDuration(long currentValue, long newValue) { return currentValue > newValue ? currentValue - newValue : newValue - currentValue; } - protected override string FormatCount(ulong count) + protected override string FormatCount(long count) { return $@"{count}x"; } - public override void Increment(ulong amount) + public override void Increment(long amount) { Current.Value = Current + amount; } - - protected class TransformComboResult : Transform - { - public virtual ulong CurrentValue - { - get - { - double time = Time?.Current ?? 0; - if (time < StartTime) return StartValue; - if (time >= EndTime) return EndValue; - - return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); - } - } - - public override void Apply(Drawable d) => ((ComboResultCounter)d).DisplayedCount = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ComboResultCounter)d).DisplayedCount; - } } } diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index f8235e5bcf..e72310f1fe 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Play.HUD else unrankedText.Hide(); - iconsContainer.Flush(); + iconsContainer.FinishTransforms(); iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint); expand(); using (iconsContainer.BeginDelayedSequence(1200)) diff --git a/osu.Game/Screens/Play/HUD/StandardComboCounter.cs b/osu.Game/Screens/Play/HUD/StandardComboCounter.cs index 525e52d207..04fe78116e 100644 --- a/osu.Game/Screens/Play/HUD/StandardComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/StandardComboCounter.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Framework.Graphics; namespace osu.Game.Screens.Play.HUD { diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index cac1f1a71b..b4b3bd885e 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -97,9 +97,9 @@ namespace osu.Game.Screens.Play.HUD if (judgement.Result == HitResult.Miss) return; - fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint); - fill.Delay(glow_fade_delay); - fill.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); + fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint) + .Delay(glow_fade_delay) + .FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); } protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 3248495b61..70093a1407 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -98,10 +98,7 @@ namespace osu.Game.Screens.Play // in the case a replay isn't loaded, we want some elements to only appear briefly. if (!replayLoaded) - { - using (ModDisplay.BeginDelayedSequence(2000)) - ModDisplay.FadeOut(200); - } + ModDisplay.Delay(2000).FadeOut(200); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index b4b2691390..01e20fdbd7 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play private void load(OsuConfigManager config) { showKeyCounter = config.GetBindable(OsuSetting.KeyOverlay); - showKeyCounter.ValueChanged += keyCounterVisibility => FadeTo(keyCounterVisibility ? 1 : 0, duration); + showKeyCounter.ValueChanged += keyCounterVisibility => this.FadeTo(keyCounterVisibility ? 1 : 0, duration); showKeyCounter.TriggerChange(); } diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index aedbffbab9..ee08bcc031 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -76,8 +76,8 @@ namespace osu.Game.Screens.Play public override bool HandleInput => State == Visibility.Visible; - protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In); - protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In); + protected override void PopIn() => this.FadeIn(transition_duration, EasingTypes.In); + protected override void PopOut() => this.FadeOut(transition_duration, EasingTypes.In); // Don't let mouse down events through the overlay or people can click circles while paused. protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index f052bafd63..eed5cd1c20 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -56,11 +56,7 @@ namespace osu.Game.Screens.Play AddInternal(pauseOverlay = new PauseOverlay { - OnResume = delegate - { - Delay(400); - Schedule(Resume); - }, + OnResume = () => this.Delay(400).Schedule(Resume), OnRetry = () => OnRetry(), OnQuit = () => OnQuit(), }); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9e124fcd71..c22a02ed35 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -269,19 +269,17 @@ namespace osu.Game.Screens.Play dimLevel.ValueChanged += newDim => Background?.FadeTo(1 - (float)newDim, 800); - Content.ScaleTo(0.7f); + Content + .ScaleTo(0.7f) + .ScaleTo(1, 750, EasingTypes.OutQuint) + .Delay(250) + .FadeIn(250); - using (Content.BeginDelayedSequence(250)) - Content.FadeIn(250); - - Content.ScaleTo(1, 750, EasingTypes.OutQuint); - - using (BeginDelayedSequence(750)) - Schedule(() => - { - if (!pauseContainer.IsPaused) - decoupledClock.Start(); - }); + this.Delay(750).Schedule(() => + { + if (!pauseContainer.IsPaused) + decoupledClock.Start(); + }); pauseContainer.Alpha = 0; pauseContainer.FadeIn(750, EasingTypes.OutQuint); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index cdb608e74d..bd4ca768b8 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -77,9 +77,7 @@ namespace osu.Game.Screens.Play RestartRequested = player.RestartRequested, }); - Delay(400); - - Schedule(pushWhenLoaded); + this.Delay(400).Schedule(pushWhenLoaded); } private void contentIn() @@ -104,16 +102,9 @@ namespace osu.Game.Screens.Play contentIn(); - Delay(500, true); - - logo.MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); - Delay(250, true); - - info.FadeIn(500); - - Delay(1400, true); - - Schedule(pushWhenLoaded); + logo.Delay(500).MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); + info.Delay(750).FadeIn(500); + this.Delay(2150).Schedule(pushWhenLoaded); } private void pushWhenLoaded() @@ -123,9 +114,7 @@ namespace osu.Game.Screens.Play contentOut(); - Delay(250); - - Schedule(() => + this.Delay(250).Schedule(() => { if (!IsCurrentScreen) return; @@ -143,7 +132,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { Content.ScaleTo(0.7f, 150, EasingTypes.InQuint); - FadeOut(150); + this.FadeOut(150); return base.OnExiting(next); } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index b0e3de0ea4..6637680c15 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -100,9 +100,9 @@ namespace osu.Game.Screens.Play return; } - FadeInFromZero(fade_time); + this.FadeInFromZero(fade_time); using (BeginAbsoluteSequence(beginFadeTime)) - FadeOut(fade_time); + this.FadeOut(fade_time); button.Action = () => AudioClock?.Seek(startTime - skip_required_cutoff - fade_time); @@ -154,14 +154,14 @@ namespace osu.Game.Screens.Play { case Visibility.Visible: if (lastState == Visibility.Hidden) - FadeIn(500, EasingTypes.OutExpo); + this.FadeIn(500, EasingTypes.OutExpo); if (!IsHovered) using (BeginDelayedSequence(1000)) scheduledHide = Schedule(() => State = Visibility.Hidden); break; case Visibility.Hidden: - FadeOut(1000, EasingTypes.OutExpo); + this.FadeOut(1000, EasingTypes.OutExpo); break; } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index ea91089aa4..b0684b80cc 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -122,18 +122,18 @@ namespace osu.Game.Screens.Play private void updateBarVisibility() { bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, EasingTypes.In); - MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); + this.MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); } protected override void PopIn() { updateBarVisibility(); - FadeIn(500, EasingTypes.OutQuint); + this.FadeIn(500, EasingTypes.OutQuint); } protected override void PopOut() { - FadeOut(100); + this.FadeOut(100); } protected override void Update() diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 93f6fec862..a0bf42599b 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -67,20 +67,23 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.FadeOut(); currentPage.FadeOut(); - circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleOuterBackground + .FadeIn(transition_time, EasingTypes.OutQuint) + .ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.25f, true)) { - circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleOuter + .FadeIn(transition_time, EasingTypes.OutQuint) + .ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.3f, true)) { backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); - circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleInner + .FadeIn(transition_time, EasingTypes.OutQuint) + .ScaleTo(1, transition_time, EasingTypes.OutQuint); using (BeginDelayedSequence(transition_time * 0.4f, true)) { diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index 59173748ed..7f381ebf99 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -33,8 +33,7 @@ namespace osu.Game.Screens.Ranking protected override void LoadComplete() { base.LoadComplete(); - fill.Delay(400); - fill.FadeInFromZero(600); + fill.Delay(400).FadeInFromZero(600); } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 96e63585bf..09db835144 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -178,9 +178,9 @@ namespace osu.Game.Screens.Ranking int delay = 0; foreach (var s in statisticsContainer.Children) { - s.FadeOut(); - s.Delay(delay += 200); - s.FadeIn(300 + delay, EasingTypes.Out); + s.FadeOut() + .Then(delay += 200) + .FadeIn(300 + delay, EasingTypes.Out); } }); } diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index 21239e8030..7eac2407e9 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -44,13 +44,14 @@ namespace osu.Game.Screens boxContainer.ScaleTo(0.2f); boxContainer.RotateTo(-20); - Content.Delay(300, true); + using (Content.BeginDelayedSequence(300, true)) + { + boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); + boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); - boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); - boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); - - textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); - Content.FadeIn(transition_time, EasingTypes.OutExpo); + textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); + Content.FadeIn(transition_time, EasingTypes.OutExpo); + } } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 8ba450720b..fbe0015d52 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -57,14 +57,14 @@ namespace osu.Game.Screens.Select protected override void PopIn() { - MoveToX(0, 800, EasingTypes.OutQuint); - RotateTo(0, 800, EasingTypes.OutQuint); + this.MoveToX(0, 800, EasingTypes.OutQuint); + this.RotateTo(0, 800, EasingTypes.OutQuint); } protected override void PopOut() { - MoveToX(-100, 800, EasingTypes.InQuint); - RotateTo(10, 800, EasingTypes.InQuint); + this.MoveToX(-100, 800, EasingTypes.InQuint); + this.RotateTo(10, 800, EasingTypes.InQuint); } public void UpdateBeatmap(WorkingBeatmap beatmap) @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Select Shear = -Shear, OnLoadComplete = d => { - FadeIn(250); + this.FadeIn(250); lastContainer?.FadeOut(250); lastContainer?.Expire(); diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 2a8e4ca5fb..91bc55f143 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -63,8 +63,8 @@ namespace osu.Game.Screens.Select.Leaderboards }; scrollFlow.Add(ls); - ls.Delay(i++ * 50, true); - ls.Show(); + using (BeginDelayedSequence(i++ * 50, true)) + ls.Show(); } scrollContainer.ScrollTo(0f, false); diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 48de4c2d3a..b0e234e5a2 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -61,26 +61,29 @@ namespace osu.Game.Screens.Select.Leaderboards nameLabel.MoveToX(150); break; case Visibility.Visible: - FadeIn(200); + this.FadeIn(200); content.MoveToY(0, 800, EasingTypes.OutQuint); - Delay(100, true); - avatar.FadeIn(300, EasingTypes.OutQuint); - nameLabel.FadeIn(350, EasingTypes.OutQuint); - - avatar.MoveToX(0, 300, EasingTypes.OutQuint); - nameLabel.MoveToX(0, 350, EasingTypes.OutQuint); - - Delay(250, true); - scoreLabel.FadeIn(200); - scoreRank.FadeIn(200); - - Delay(50, true); - var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, }; - - for (int i = 0; i < drawables.Length; i++) + using (BeginDelayedSequence(100, true)) { - drawables[i].FadeIn(100 + i * 50); + avatar.FadeIn(300, EasingTypes.OutQuint); + nameLabel.FadeIn(350, EasingTypes.OutQuint); + + avatar.MoveToX(0, 300, EasingTypes.OutQuint); + nameLabel.MoveToX(0, 350, EasingTypes.OutQuint); + + using (BeginDelayedSequence(250, true)) + { + scoreLabel.FadeIn(200); + scoreRank.FadeIn(200); + + using (BeginDelayedSequence(50, true)) + { + var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, }; + for (int i = 0; i < drawables.Length; i++) + drawables[i].FadeIn(100 + i * 50); + } + } } break; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index 6345807ea3..4b9a85f7f8 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select.Options { base.PopIn(); - FadeIn(transition_duration, EasingTypes.OutQuint); + this.FadeIn(transition_duration, EasingTypes.OutQuint); if (buttonsContainer.Position.X == 1 || Alpha == 0) buttonsContainer.MoveToX(x_position - x_movement); @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Options buttonsContainer.MoveToX(x_position + x_movement, transition_duration, EasingTypes.InSine); buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, EasingTypes.InSine); - FadeOut(transition_duration, EasingTypes.InQuint); + this.FadeOut(transition_duration, EasingTypes.InQuint); } public BeatmapOptionsOverlay() diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 246fa17e85..7cd81a924d 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -47,10 +47,13 @@ namespace osu.Game.Screens.Tournament public ITeamList TeamList; - protected override DependencyContainer CreateLocalDependencies(DependencyContainer parent) => new DependencyContainer(parent); + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); [BackgroundDependencyLoader] - private void load(TextureStore textures, Storage storage, DependencyContainer dependencies) + private void load(TextureStore textures, Storage storage) { this.storage = storage; diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 30f109e598..ae0f6e4b3f 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Framework.Threading; using OpenTK; using OpenTK.Graphics; @@ -29,7 +28,11 @@ namespace osu.Game.Screens.Tournament private readonly Container tracker; +#pragma warning disable 649 + // set via reflection. private float speed; +#pragma warning restore 649 + private int expiredCount; private float offset; @@ -297,7 +300,8 @@ namespace osu.Game.Screens.Tournament } } - private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => TransformTo(value, duration, easing, new TransformScrollSpeed()); + private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => + this.TransformTo(nameof(speed), value, duration, easing); private enum ScrollState { @@ -308,12 +312,6 @@ namespace osu.Game.Screens.Tournament Scrolling } - public class TransformScrollSpeed : TransformFloat - { - public override void Apply(Drawable d) => ((ScrollingTeamContainer)d).speed = CurrentValue; - public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScrollingTeamContainer)d).speed; - } - public class ScrollingTeam : Container { public const float WIDTH = 58; diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 0780c2ffd0..b3c227855d 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -192,13 +192,13 @@ namespace osu.Game.Users { statusBar.ResizeHeightTo(0f, transition_duration, EasingTypes.OutQuint); statusBar.FadeOut(transition_duration, EasingTypes.OutQuint); - ResizeHeightTo(height - status_height, transition_duration, EasingTypes.OutQuint); + this.ResizeHeightTo(height - status_height, transition_duration, EasingTypes.OutQuint); } else { statusBar.ResizeHeightTo(status_height, transition_duration, EasingTypes.OutQuint); statusBar.FadeIn(transition_duration, EasingTypes.OutQuint); - ResizeHeightTo(height, transition_duration, EasingTypes.OutQuint); + this.ResizeHeightTo(height, transition_duration, EasingTypes.OutQuint); statusMessage.Text = status.Message; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 95b339afb5..6031304b26 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -134,7 +134,6 @@ -