2017-10-05 04:06:31 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using OpenTK;
|
2017-10-05 07:50:13 +08:00
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2017-10-05 04:06:31 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-10-05 07:50:13 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics;
|
2017-10-05 04:06:31 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Menu
|
|
|
|
|
{
|
|
|
|
|
public class IntroSequence : Container
|
|
|
|
|
{
|
2017-10-10 06:36:40 +08:00
|
|
|
|
private readonly OsuSpriteText welcomeText;
|
2017-10-05 04:06:31 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
private readonly OsuLogo logo;
|
|
|
|
|
|
2017-10-05 07:50:13 +08:00
|
|
|
|
private readonly Container barTopLeft;
|
|
|
|
|
private readonly Container barBottomLeft;
|
|
|
|
|
private readonly Container barTopRight;
|
|
|
|
|
private readonly Container barBottomRight;
|
|
|
|
|
|
|
|
|
|
private readonly Ring smallRing;
|
|
|
|
|
private readonly Ring mediumRing;
|
|
|
|
|
private readonly Ring bigRing;
|
|
|
|
|
|
|
|
|
|
private readonly Container backgroundFill;
|
|
|
|
|
private readonly Container foregroundFill;
|
|
|
|
|
|
|
|
|
|
private readonly CircularContainer pinkCircle;
|
|
|
|
|
private readonly CircularContainer blueCircle;
|
|
|
|
|
private readonly CircularContainer yellowCircle;
|
|
|
|
|
private readonly CircularContainer purpleCircle;
|
|
|
|
|
|
2017-10-05 04:06:31 +08:00
|
|
|
|
public IntroSequence()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-10-05 07:50:13 +08:00
|
|
|
|
new CircularContainer
|
2017-10-05 04:06:31 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2017-10-06 02:37:37 +08:00
|
|
|
|
Size = new Vector2(460),
|
2017-10-05 07:50:13 +08:00
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
mediumRing = new Ring(Color4.White.Opacity(80)),
|
|
|
|
|
barTopLeft = new Container
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Rotation = 45,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.White.Opacity(180),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
barTopRight = new Container
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Rotation = -45,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.White.Opacity(80),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
barBottomLeft = new Container
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Rotation = -45,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.White.Opacity(230),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
barBottomRight = new Container
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Rotation = 45,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.White.Opacity(130),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
smallRing = new Ring(Color4.White),
|
|
|
|
|
bigRing = new Ring(OsuColour.FromHex(@"B6C5E9")),
|
|
|
|
|
backgroundFill = new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2017-10-10 08:57:15 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-05 07:50:13 +08:00
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.FromHex(@"C6D8FF").Opacity(160),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
welcomeText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Text = "welcome",
|
|
|
|
|
Font = @"Exo2.0-Light",
|
|
|
|
|
TextSize = 42,
|
|
|
|
|
},
|
|
|
|
|
foregroundFill = new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2017-10-10 08:57:15 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-05 07:50:13 +08:00
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.White,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
purpleCircle = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-06 02:37:37 +08:00
|
|
|
|
Colour = OsuColour.FromHex(@"AA92FF"),
|
2017-10-05 07:50:13 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
yellowCircle = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-06 02:37:37 +08:00
|
|
|
|
Colour = OsuColour.FromHex(@"FFD64C"),
|
2017-10-05 07:50:13 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
blueCircle = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-06 02:37:37 +08:00
|
|
|
|
Colour = OsuColour.FromHex(@"8FE5FE"),
|
2017-10-05 07:50:13 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
pinkCircle = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-06 02:37:37 +08:00
|
|
|
|
Colour = OsuColour.FromHex(@"e967a1"),
|
2017-10-05 07:50:13 +08:00
|
|
|
|
}
|
2017-10-06 02:37:37 +08:00
|
|
|
|
},
|
|
|
|
|
logo = new OsuLogo
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Ripple = false,
|
|
|
|
|
Interactive = false,
|
|
|
|
|
Blending = BlendingMode.Additive,
|
|
|
|
|
},
|
2017-10-05 04:06:31 +08:00
|
|
|
|
};
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
|
|
|
|
setDefaults();
|
2017-10-05 04:06:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
2017-10-06 02:37:37 +08:00
|
|
|
|
welcomeText.Delay(350).ScaleTo(1, 250, Easing.Out);
|
|
|
|
|
welcomeText.Delay(350).FadeIn(1000, Easing.Out);
|
|
|
|
|
welcomeText.Delay(350).TransformSpacingTo(new Vector2(20, 0), 1450, Easing.Out);
|
|
|
|
|
|
|
|
|
|
mediumRing.Background.ResizeTo(120, 500, Easing.InExpo);
|
2017-10-10 08:57:15 +08:00
|
|
|
|
mediumRing.Foreground.ResizeTo(0.8f, 500, Easing.InQuint).Then().ResizeTo(1, 1000, Easing.OutQuint);
|
2017-10-06 02:37:37 +08:00
|
|
|
|
|
|
|
|
|
smallRing.Background.Delay(100).ResizeTo(45, 500, Easing.InExpo);
|
2017-10-10 08:57:15 +08:00
|
|
|
|
smallRing.Foreground.Delay(100).ResizeTo(0.8f, 500, Easing.InQuint).Then().ResizeTo(1, 2000, Easing.OutQuint);
|
2017-10-06 02:37:37 +08:00
|
|
|
|
|
|
|
|
|
barTopLeft.Delay(500).FadeIn();
|
|
|
|
|
barTopLeft.Delay(500).MoveTo(new Vector2(-120, -120), 900, Easing.OutQuint);
|
|
|
|
|
barTopLeft.Delay(600).ResizeWidthTo(0, 900, Easing.OutExpo);
|
|
|
|
|
|
|
|
|
|
barTopRight.Delay(500).FadeIn();
|
|
|
|
|
barTopRight.Delay(500).MoveTo(new Vector2(120, -120), 900, Easing.OutQuint);
|
|
|
|
|
barTopRight.Delay(600).ResizeWidthTo(0, 900, Easing.OutExpo);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
barBottomLeft.Delay(500).FadeIn();
|
|
|
|
|
barBottomLeft.Delay(500).MoveTo(new Vector2(-120, 120), 900, Easing.OutQuint);
|
|
|
|
|
barBottomLeft.Delay(600).ResizeWidthTo(0, 900, Easing.OutExpo);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
barBottomRight.Delay(500).FadeIn();
|
|
|
|
|
barBottomRight.Delay(500).MoveTo(new Vector2(120, 120), 900, Easing.OutQuint);
|
|
|
|
|
barBottomRight.Delay(600).ResizeWidthTo(0, 900, Easing.OutExpo);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
bigRing.Background.Delay(1950).ResizeTo(400, 550, Easing.InOutQuint);
|
2017-10-10 08:57:15 +08:00
|
|
|
|
bigRing.Foreground.Delay(1950).ResizeTo(0.8f, 450, Easing.InExpo).Then().ResizeTo(1, 500, Easing.OutExpo);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-10 08:57:15 +08:00
|
|
|
|
backgroundFill.Delay(2317).ResizeHeightTo(1, 650, Easing.InOutQuint);
|
2017-10-06 02:37:37 +08:00
|
|
|
|
backgroundFill.Delay(2317).RotateTo(-90, 650, Easing.InOutQuint);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-10 08:57:15 +08:00
|
|
|
|
foregroundFill.Delay(2350).ResizeWidthTo(1, 650, Easing.InOutQuint);
|
2017-10-06 02:37:37 +08:00
|
|
|
|
foregroundFill.Delay(2350).RotateTo(-90, 650, Easing.InOutQuint);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
yellowCircle.Delay(2383).MoveToY(-207, 617, Easing.InOutQuad);
|
|
|
|
|
yellowCircle.Delay(2383).RotateTo(-180, 617, Easing.InOutQuad);
|
|
|
|
|
yellowCircle.Delay(2383).ResizeTo(414, 617, Easing.InOutExpo);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
purpleCircle.Delay(2317).MoveToY(207, 683, Easing.InOutQuad);
|
|
|
|
|
purpleCircle.Delay(2317).RotateTo(-180, 683, Easing.InOutQuad);
|
|
|
|
|
purpleCircle.Delay(2317).ResizeTo(414, 683, Easing.InOutExpo);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
blueCircle.Delay(2449).MoveToX(-207, 551, Easing.InOutQuad);
|
|
|
|
|
blueCircle.Delay(2449).RotateTo(-180, 551, Easing.InOutQuad);
|
|
|
|
|
blueCircle.Delay(2449).ResizeTo(414, 551, Easing.InOutExpo);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
pinkCircle.Delay(2515).MoveToX(208, 485, Easing.InOutQuad);
|
|
|
|
|
pinkCircle.Delay(2515).RotateTo(-180, 485, Easing.InOutQuad);
|
|
|
|
|
pinkCircle.Delay(2515).ResizeTo(416, 485, Easing.InOutExpo);
|
|
|
|
|
|
|
|
|
|
logo.Delay(3200).FadeIn(300);
|
|
|
|
|
|
|
|
|
|
backgroundFill.Delay(3200).FadeOut();
|
|
|
|
|
foregroundFill.Delay(3500).FadeOut();
|
2017-10-05 04:06:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-05 07:50:13 +08:00
|
|
|
|
private void setDefaults()
|
2017-10-05 04:06:31 +08:00
|
|
|
|
{
|
2017-10-06 02:37:37 +08:00
|
|
|
|
logo.Alpha = 0;
|
|
|
|
|
|
|
|
|
|
welcomeText.Scale = new Vector2(0.9f);
|
2017-10-05 04:06:31 +08:00
|
|
|
|
welcomeText.Spacing = Vector2.Zero;
|
2017-10-06 02:37:37 +08:00
|
|
|
|
welcomeText.Alpha = 0;
|
2017-10-05 04:06:31 +08:00
|
|
|
|
|
2017-10-05 07:50:13 +08:00
|
|
|
|
smallRing.Background.Size = smallRing.Foreground.Size = Vector2.Zero;
|
|
|
|
|
mediumRing.Background.Size = mediumRing.Foreground.Size = Vector2.Zero;
|
|
|
|
|
bigRing.Background.Size = bigRing.Foreground.Size = Vector2.Zero;
|
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
barTopLeft.Size = barTopRight.Size = barBottomLeft.Size = barBottomRight.Size = new Vector2(115, 1.5f);
|
|
|
|
|
barTopLeft.Alpha = barTopRight.Alpha = barBottomLeft.Alpha = barBottomRight.Alpha = 0;
|
|
|
|
|
barTopLeft.Position = new Vector2(-90, -90);
|
|
|
|
|
barTopRight.Position = new Vector2(90, -90);
|
|
|
|
|
barBottomLeft.Position = new Vector2(-90, 90);
|
|
|
|
|
barBottomRight.Position = new Vector2(90, 90);
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
backgroundFill.Rotation = foregroundFill.Rotation = 0;
|
|
|
|
|
backgroundFill.Alpha = foregroundFill.Alpha = 1;
|
2017-10-10 08:57:15 +08:00
|
|
|
|
backgroundFill.Height = foregroundFill.Width = 0;
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-06 02:37:37 +08:00
|
|
|
|
yellowCircle.Size = purpleCircle.Size = blueCircle.Size = pinkCircle.Size = Vector2.Zero;
|
|
|
|
|
yellowCircle.Rotation = purpleCircle.Rotation = blueCircle.Rotation = pinkCircle.Rotation = 0;
|
2017-10-05 07:50:13 +08:00
|
|
|
|
yellowCircle.Position = new Vector2(0, -300);
|
|
|
|
|
purpleCircle.Position = new Vector2(0, 300);
|
|
|
|
|
blueCircle.Position = new Vector2(-300, 0);
|
|
|
|
|
pinkCircle.Position = new Vector2(300, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Restart()
|
|
|
|
|
{
|
|
|
|
|
FinishTransforms(true);
|
|
|
|
|
setDefaults();
|
2017-10-05 04:06:31 +08:00
|
|
|
|
Start();
|
|
|
|
|
}
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
2017-10-10 08:57:15 +08:00
|
|
|
|
private class Ring : CircularContainer
|
2017-10-05 07:50:13 +08:00
|
|
|
|
{
|
2017-10-10 08:57:15 +08:00
|
|
|
|
public readonly Container Background;
|
2017-10-10 06:36:40 +08:00
|
|
|
|
public readonly CircularContainer Foreground;
|
2017-10-05 07:50:13 +08:00
|
|
|
|
|
|
|
|
|
public Ring(Color4 ringColour)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
2017-10-10 08:57:15 +08:00
|
|
|
|
Masking = true;
|
2017-10-05 07:50:13 +08:00
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2017-10-10 08:57:15 +08:00
|
|
|
|
Background = new Container
|
2017-10-05 07:50:13 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ringColour,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Foreground = new CircularContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2017-10-10 08:57:15 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-10-05 07:50:13 +08:00
|
|
|
|
Masking = true,
|
|
|
|
|
Child = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-10-05 04:06:31 +08:00
|
|
|
|
}
|
|
|
|
|
}
|