1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Get rid of raw AddDelay calls within osu.Game

This commit is contained in:
Thomas Müller 2017-07-17 16:51:21 +03:00
parent 19fb03e737
commit 87bcd526f3
19 changed files with 67 additions and 96 deletions

@ -1 +1 @@
Subproject commit a3ed5b642fcce039483801ca01fdbbf9117cec15 Subproject commit 8463ba949b0a4a54c9aca157b2b24a8b0277608a

View File

@ -56,10 +56,7 @@ namespace osu.Desktop.VisualTests.Tests
} }
if (remaining > 0) if (remaining > 0)
{ Scheduler.AddDelayed(() => sendBarrage(remaining - 1), 80);
AddDelay(80);
Schedule(() => sendBarrage(remaining - 1));
}
} }
protected override void Update() protected override void Update()

View File

@ -67,6 +67,8 @@ namespace osu.Desktop.VisualTests.Tests
private void changePlayfieldSize(int step) private void changePlayfieldSize(int step)
{ {
double delay = 0;
// Add new hits // Add new hits
switch (step) switch (step)
{ {
@ -84,7 +86,7 @@ namespace osu.Desktop.VisualTests.Tests
break; break;
case 5: case 5:
addSwell(1000); addSwell(1000);
playfieldContainer.AddDelay(scroll_time - 100); delay = scroll_time - 100;
break; break;
} }
@ -92,10 +94,10 @@ namespace osu.Desktop.VisualTests.Tests
switch (step) switch (step)
{ {
default: default:
playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, rng.Next(25, 400)), 500);
break; break;
case 6: 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; break;
} }
} }

View File

@ -62,14 +62,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime); var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime);
this.ScaleTo(0.5f); this.Animate(
this.ScaleTo(1.2f, animIn); d => d.FadeIn(animIn),
this.FadeIn(animIn); d => d.ScaleTo(0.5f).ScaleTo(1.2f, animIn)
).Then(
AddDelay(animIn); d => d.ScaleTo(1, 150, EasingTypes.Out)
this.ScaleTo(1, 150, EasingTypes.Out); );
AddDelay(-animIn);
} }
protected override void UpdateCurrentState(ArmedState state) protected override void UpdateCurrentState(ArmedState state)

View File

@ -99,8 +99,7 @@ namespace osu.Game.Graphics.UserInterface
colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In); colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In);
flash(); flash();
AddDelay(click_duration); this.Delay(click_duration).Schedule(delegate {
Schedule(delegate {
colourContainer.ResizeTo(new Vector2(0.8f, 1f)); colourContainer.ResizeTo(new Vector2(0.8f, 1f));
spriteText.Spacing = Vector2.Zero; spriteText.Spacing = Vector2.Zero;
glowContainer.FadeOut(); glowContainer.FadeOut();

View File

@ -106,8 +106,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
private void schedulePopOut() private void schedulePopOut()
{ {
popOutDelegate?.Cancel(); popOutDelegate?.Cancel();
AddDelay(1000); this.Delay(1000).Schedule(Hide, out popOutDelegate);
popOutDelegate = Schedule(Hide);
} }
} }
} }

View File

@ -119,8 +119,7 @@ namespace osu.Game
if (!menu.IsCurrentScreen) if (!menu.IsCurrentScreen)
{ {
menu.MakeCurrent(); menu.MakeCurrent();
AddDelay(500); this.Delay(500).Schedule(() => LoadScore(s), out scoreLoad);
scoreLoad = Schedule(() => LoadScore(s));
return; return;
} }

View File

@ -35,8 +35,7 @@ namespace osu.Game.Overlays
if (v != Visibility.Hidden) return; if (v != Visibility.Hidden) return;
//handle the dialog being dismissed. //handle the dialog being dismissed.
dialog.AddDelay(PopupDialog.EXIT_DURATION); dialog.Delay(PopupDialog.EXIT_DURATION).Expire();
dialog.Expire();
if (dialog == currentDialog) if (dialog == currentDialog)
State = Visibility.Hidden; State = Visibility.Hidden;

View File

@ -78,10 +78,7 @@ namespace osu.Game.Overlays.Notifications
{ {
case ProgressNotificationState.Completed: case ProgressNotificationState.Completed:
NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint); NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint);
this.FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run. this.FadeOut(200).Finally(d => Completed());
AddDelay(100);
Schedule(Completed);
break; break;
} }
} }

View File

@ -75,15 +75,13 @@ namespace osu.Game.Rulesets.Judgements
this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); this.MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint);
this.RotateTo(40, 800, EasingTypes.InQuint); this.RotateTo(40, 800, EasingTypes.InQuint);
AddDelay(600); this.Delay(600).FadeOut(200);
this.FadeOut(200);
break; break;
case HitResult.Hit: case HitResult.Hit:
this.ScaleTo(0.9f); this.ScaleTo(0.9f);
this.ScaleTo(1, 500, EasingTypes.OutElastic); this.ScaleTo(1, 500, EasingTypes.OutElastic);
AddDelay(100); this.Delay(100).FadeOut(400);
this.FadeOut(400);
break; break;
} }

View File

@ -98,18 +98,13 @@ namespace osu.Game.Screens.Menu
{ {
base.OnEntering(last); base.OnEntering(last);
Content.FadeInFromZero(500); icon.Delay(1500).FadeColour(iconColour, 200);
icon.AddDelay(1500); Content
icon.FadeColour(iconColour, 200); .FadeInFromZero(500)
.Then(5500)
AddDelay(6000, true); .FadeOut(250)
.Finally(d => Push(intro));
Content.FadeOut(250);
AddDelay(250);
Schedule(() => Push(intro));
} }
} }
} }

View File

@ -97,9 +97,9 @@ namespace osu.Game.Screens.Play.HUD
if (judgement.Result == HitResult.Miss) if (judgement.Result == HitResult.Miss)
return; return;
fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint); fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint)
fill.AddDelay(glow_fade_delay); .Delay(glow_fade_delay)
fill.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); .FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint);
} }
protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);

View File

@ -56,11 +56,7 @@ namespace osu.Game.Screens.Play
AddInternal(pauseOverlay = new PauseOverlay AddInternal(pauseOverlay = new PauseOverlay
{ {
OnResume = delegate OnResume = () => this.Delay(400).Schedule(Resume),
{
AddDelay(400);
Schedule(Resume);
},
OnRetry = () => OnRetry(), OnRetry = () => OnRetry(),
OnQuit = () => OnQuit(), OnQuit = () => OnQuit(),
}); });

View File

@ -77,9 +77,7 @@ namespace osu.Game.Screens.Play
Beatmap = player.Beatmap, Beatmap = player.Beatmap,
}); });
AddDelay(400); this.Delay(400).Schedule(pushWhenLoaded);
Schedule(pushWhenLoaded);
} }
private void contentIn() private void contentIn()
@ -104,16 +102,9 @@ namespace osu.Game.Screens.Play
contentIn(); contentIn();
AddDelay(500, true); logo.Delay(500).MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo);
info.Delay(750).FadeIn(500);
logo.MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); this.Delay(2150).Schedule(pushWhenLoaded);
AddDelay(250, true);
info.FadeIn(500);
AddDelay(1400, true);
Schedule(pushWhenLoaded);
} }
private void pushWhenLoaded() private void pushWhenLoaded()
@ -123,9 +114,7 @@ namespace osu.Game.Screens.Play
contentOut(); contentOut();
AddDelay(250); this.Delay(250).Schedule(() =>
Schedule(() =>
{ {
if (!IsCurrentScreen) return; if (!IsCurrentScreen) return;

View File

@ -33,8 +33,7 @@ namespace osu.Game.Screens.Ranking
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
fill.AddDelay(400); fill.Delay(400).FadeInFromZero(600);
fill.FadeInFromZero(600);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -178,9 +178,9 @@ namespace osu.Game.Screens.Ranking
int delay = 0; int delay = 0;
foreach (var s in statisticsContainer.Children) foreach (var s in statisticsContainer.Children)
{ {
s.FadeOut(); s.FadeOut()
s.AddDelay(delay += 200); .Then(delay += 200)
s.FadeIn(300 + delay, EasingTypes.Out); .FadeIn(300 + delay, EasingTypes.Out);
} }
}); });
} }

View File

@ -44,13 +44,14 @@ namespace osu.Game.Screens
boxContainer.ScaleTo(0.2f); boxContainer.ScaleTo(0.2f);
boxContainer.RotateTo(-20); boxContainer.RotateTo(-20);
Content.AddDelay(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); textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo);
boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); 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) protected override bool OnExiting(Screen next)

View File

@ -63,8 +63,8 @@ namespace osu.Game.Screens.Select.Leaderboards
}; };
scrollFlow.Add(ls); scrollFlow.Add(ls);
ls.AddDelay(i++ * 50, true); using (BeginDelayedSequence(i++ * 50, true))
ls.Show(); ls.Show();
} }
scrollContainer.ScrollTo(0f, false); scrollContainer.ScrollTo(0f, false);

View File

@ -64,23 +64,26 @@ namespace osu.Game.Screens.Select.Leaderboards
this.FadeIn(200); this.FadeIn(200);
content.MoveToY(0, 800, EasingTypes.OutQuint); content.MoveToY(0, 800, EasingTypes.OutQuint);
AddDelay(100, true); using (BeginDelayedSequence(100, true))
avatar.FadeIn(300, EasingTypes.OutQuint);
nameLabel.FadeIn(350, EasingTypes.OutQuint);
avatar.MoveToX(0, 300, EasingTypes.OutQuint);
nameLabel.MoveToX(0, 350, EasingTypes.OutQuint);
AddDelay(250, true);
scoreLabel.FadeIn(200);
scoreRank.FadeIn(200);
AddDelay(50, true);
var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, };
for (int i = 0; i < drawables.Length; i++)
{ {
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; break;