1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Remove need for waves array; use generic container.

This commit is contained in:
Dean Herbert 2017-02-23 11:26:50 +09:00
parent d154cf7938
commit 521a9b7728
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -48,8 +49,9 @@ namespace osu.Game.Overlays
private const float third_wave_rotation = 4; private const float third_wave_rotation = 4;
private const float fourth_wave_rotation = -2; private const float fourth_wave_rotation = -2;
private Container firstWave, secondWave, thirdWave, fourthWave, wavesContainer; private Wave firstWave, secondWave, thirdWave, fourthWave;
private readonly Container[] waves;
private Container<Wave> wavesContainer;
private readonly Container contentContainer; private readonly Container contentContainer;
protected override Container<Drawable> Content => contentContainer; protected override Container<Drawable> Content => contentContainer;
@ -118,9 +120,11 @@ namespace osu.Game.Overlays
{ {
base.Show(); base.Show();
for (int i = 0; i < waves.Length; i++) int i = 0;
foreach (var w in wavesContainer.Children)
{ {
waves[i].MoveToY(wavePositions[i], waveDurations[i], EasingTypes.OutQuint); w.MoveToY(wavePositions[i], waveDurations[i], EasingTypes.OutQuint);
i++;
} }
DelayReset(); DelayReset();
@ -149,10 +153,8 @@ namespace osu.Game.Overlays
contentContainer.MoveToY(DrawHeight, CONTENT_EXIT_DURATION, EasingTypes.InSine); contentContainer.MoveToY(DrawHeight, CONTENT_EXIT_DURATION, EasingTypes.InSine);
TransitionOut(); TransitionOut();
for (int i = 0; i < waves.Length; i++) foreach (var w in wavesContainer.Children)
{ w.MoveToY(DrawHeight, second_wave_duration, EasingTypes.InSine);
waves[i].MoveToY(DrawHeight, second_wave_duration, EasingTypes.InSine);
}
DelayReset(); DelayReset();
Delay(container_wait); Delay(container_wait);
@ -171,12 +173,12 @@ namespace osu.Game.Overlays
{ {
Masking = true; Masking = true;
AddInternal(wavesContainer = new Container AddInternal(wavesContainer = new Container<Wave>
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Children = new Drawable[] Children = new Wave[]
{ {
firstWave = new Wave firstWave = new Wave
{ {
@ -220,8 +222,6 @@ namespace osu.Game.Overlays
}, },
}, },
}); });
waves = new[] { firstWave, secondWave, thirdWave, fourthWave };
} }
class Wave : Container class Wave : Container