1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 23:22:55 +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)
{
AddDelay(80);
Schedule(() => sendBarrage(remaining - 1));
}
Scheduler.AddDelayed(() => sendBarrage(remaining - 1), 80);
}
protected override void Update()

View File

@ -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.AddDelay(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;
}
}

View File

@ -62,14 +62,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime);
this.ScaleTo(0.5f);
this.ScaleTo(1.2f, animIn);
this.FadeIn(animIn);
AddDelay(animIn);
this.ScaleTo(1, 150, EasingTypes.Out);
AddDelay(-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)

View File

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

View File

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

View File

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

View File

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

View File

@ -78,10 +78,7 @@ namespace osu.Game.Overlays.Notifications
{
case ProgressNotificationState.Completed:
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.
AddDelay(100);
Schedule(Completed);
this.FadeOut(200).Finally(d => Completed());
break;
}
}

View File

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

View File

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

View File

@ -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.AddDelay(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);

View File

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

View File

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

View File

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

View File

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

View File

@ -44,13 +44,14 @@ namespace osu.Game.Screens
boxContainer.ScaleTo(0.2f);
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);
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)

View File

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

View File

@ -64,23 +64,26 @@ namespace osu.Game.Screens.Select.Leaderboards
this.FadeIn(200);
content.MoveToY(0, 800, EasingTypes.OutQuint);
AddDelay(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++)
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;