mirror of
https://github.com/ppy/osu.git
synced 2025-03-14 05:47:20 +08:00
Merge pull request #1476 from peppy/intro-v2
Add a new startup sequence
This commit is contained in:
commit
186877a290
52
osu.Game.Tests/Visual/TestCaseIntroSequence.cs
Normal file
52
osu.Game.Tests/Visual/TestCaseIntroSequence.cs
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Screens.Menu;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseIntroSequence : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(OsuLogo),
|
||||
};
|
||||
|
||||
public TestCaseIntroSequence()
|
||||
{
|
||||
OsuLogo logo;
|
||||
|
||||
var rateAdjustClock = new StopwatchClock(true);
|
||||
var framedClock = new FramedClock(rateAdjustClock);
|
||||
framedClock.ProcessFrame();
|
||||
|
||||
Add(new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Clock = framedClock,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
logo = new OsuLogo
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddStep(@"Restart", logo.PlayIntro);
|
||||
AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
|
||||
}
|
||||
}
|
||||
}
|
39
osu.Game.Tests/Visual/TestCaseOsuGame.cs
Normal file
39
osu.Game.Tests/Visual/TestCaseOsuGame.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseOsuGame : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(OsuLogo),
|
||||
};
|
||||
|
||||
public TestCaseOsuGame()
|
||||
{
|
||||
var rateAdjustClock = new StopwatchClock(true);
|
||||
var framedClock = new FramedClock(rateAdjustClock);
|
||||
framedClock.ProcessFrame();
|
||||
|
||||
Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
});
|
||||
|
||||
Add(new Loader());
|
||||
|
||||
AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
|
||||
}
|
||||
}
|
||||
}
|
@ -110,6 +110,7 @@
|
||||
<Compile Include="Visual\TestCaseGamefield.cs" />
|
||||
<Compile Include="Visual\TestCaseGraph.cs" />
|
||||
<Compile Include="Visual\TestCaseIconButton.cs" />
|
||||
<Compile Include="Visual\TestCaseIntroSequence.cs" />
|
||||
<Compile Include="Visual\TestCaseKeyConfiguration.cs" />
|
||||
<Compile Include="Visual\TestCaseKeyCounter.cs" />
|
||||
<Compile Include="Visual\TestCaseLeaderboard.cs" />
|
||||
@ -121,6 +122,7 @@
|
||||
<Compile Include="Visual\TestCaseNotificationOverlay.cs" />
|
||||
<Compile Include="Visual\TestCaseOnScreenDisplay.cs" />
|
||||
<Compile Include="Visual\TestCaseAllPlayers.cs" />
|
||||
<Compile Include="Visual\TestCaseOsuGame.cs" />
|
||||
<Compile Include="Visual\TestCasePlaySongSelect.cs" />
|
||||
<Compile Include="Visual\TestCaseReplay.cs" />
|
||||
<Compile Include="Visual\TestCaseReplaySettingsOverlay.cs" />
|
||||
|
@ -8,7 +8,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
{
|
||||
internal class Loader : OsuScreen
|
||||
public class Loader : OsuScreen
|
||||
{
|
||||
public override bool ShowOverlays => false;
|
||||
|
||||
@ -30,7 +30,7 @@ namespace osu.Game.Screens
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame game)
|
||||
private void load(OsuGameBase game)
|
||||
{
|
||||
if (game.IsDeployedBuild)
|
||||
LoadComponentAsync(new Disclaimer(), d => Push(d));
|
||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class Intro : OsuScreen
|
||||
{
|
||||
private readonly IntroSequence introSequence;
|
||||
|
||||
private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
|
||||
|
||||
/// <summary>
|
||||
@ -114,9 +116,7 @@ namespace osu.Game.Screens.Menu
|
||||
base.LogoArriving(logo, resuming);
|
||||
|
||||
logo.RelativePositionAxes = Axes.Both;
|
||||
|
||||
logo.Triangles = false;
|
||||
logo.Colour = Color4.DarkGray;
|
||||
logo.Colour = Color4.White;
|
||||
logo.Ripple = false;
|
||||
|
||||
const int quick_appear = 350;
|
||||
@ -127,14 +127,16 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
if (!resuming)
|
||||
{
|
||||
logo.ScaleTo(0.4f);
|
||||
logo.FadeOut();
|
||||
logo.Triangles = true;
|
||||
|
||||
logo.ScaleTo(1, delay_step_one + delay_step_two, Easing.OutQuint);
|
||||
logo.FadeIn(delay_step_one + delay_step_two, Easing.OutQuint);
|
||||
logo.ScaleTo(1);
|
||||
logo.FadeIn();
|
||||
logo.PlayIntro();
|
||||
}
|
||||
else
|
||||
{
|
||||
logo.Triangles = false;
|
||||
|
||||
logo
|
||||
.ScaleTo(1, initialMovementTime, Easing.OutQuint)
|
||||
.FadeIn(quick_appear, Easing.OutQuint)
|
||||
|
297
osu.Game/Screens/Menu/IntroSequence.cs
Normal file
297
osu.Game/Screens/Menu/IntroSequence.cs
Normal file
@ -0,0 +1,297 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class IntroSequence : Container
|
||||
{
|
||||
private const float logo_size = 460; //todo: this should probably be 480
|
||||
|
||||
private OsuSpriteText welcomeText;
|
||||
|
||||
private Container<Box> lines;
|
||||
|
||||
private Box lineTopLeft;
|
||||
private Box lineBottomLeft;
|
||||
private Box lineTopRight;
|
||||
private Box lineBottomRight;
|
||||
|
||||
private Ring smallRing;
|
||||
private Ring mediumRing;
|
||||
private Ring bigRing;
|
||||
|
||||
private Box backgroundFill;
|
||||
private Box foregroundFill;
|
||||
|
||||
private CircularContainer pinkCircle;
|
||||
private CircularContainer blueCircle;
|
||||
private CircularContainer yellowCircle;
|
||||
private CircularContainer purpleCircle;
|
||||
|
||||
public IntroSequence()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
const int line_offset = 80;
|
||||
const int circle_offset = 250;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
lines = new Container<Box>
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new []
|
||||
{
|
||||
lineTopLeft = new Box
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.Centre,
|
||||
Position = new Vector2(-line_offset, -line_offset),
|
||||
Rotation = 45,
|
||||
Colour = Color4.White.Opacity(180),
|
||||
},
|
||||
lineTopRight = new Box
|
||||
{
|
||||
Origin = Anchor.CentreRight,
|
||||
Anchor = Anchor.Centre,
|
||||
Position = new Vector2(line_offset, -line_offset),
|
||||
Rotation = -45,
|
||||
Colour = Color4.White.Opacity(80),
|
||||
},
|
||||
lineBottomLeft = new Box
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.Centre,
|
||||
Position = new Vector2(-line_offset, line_offset),
|
||||
Rotation = -45,
|
||||
Colour = Color4.White.Opacity(230),
|
||||
},
|
||||
lineBottomRight = new Box
|
||||
{
|
||||
Origin = Anchor.CentreRight,
|
||||
Anchor = Anchor.Centre,
|
||||
Position = new Vector2(line_offset, line_offset),
|
||||
Rotation = 45,
|
||||
Colour = Color4.White.Opacity(130),
|
||||
},
|
||||
}
|
||||
},
|
||||
bigRing = new Ring(OsuColour.FromHex(@"B6C5E9"), 0.85f),
|
||||
mediumRing = new Ring(Color4.White.Opacity(130), 0.7f),
|
||||
smallRing = new Ring(Color4.White, 0.6f),
|
||||
welcomeText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = "welcome",
|
||||
Padding = new MarginPadding { Bottom = 10 },
|
||||
Font = @"Exo2.0-Light",
|
||||
Alpha = 0,
|
||||
TextSize = 42,
|
||||
Spacing = new Vector2(5),
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(logo_size),
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
backgroundFill = new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0,
|
||||
Colour = OsuColour.FromHex(@"C6D8FF").Opacity(160),
|
||||
},
|
||||
foregroundFill = new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = Vector2.Zero,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
}
|
||||
},
|
||||
purpleCircle = new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Position = new Vector2(0, circle_offset),
|
||||
Colour = OsuColour.FromHex(@"AA92FF"),
|
||||
},
|
||||
blueCircle = new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
Position = new Vector2(-circle_offset, 0),
|
||||
Colour = OsuColour.FromHex(@"8FE5FE"),
|
||||
},
|
||||
yellowCircle = new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Position = new Vector2(0, -circle_offset),
|
||||
Colour = OsuColour.FromHex(@"FFD64C"),
|
||||
},
|
||||
pinkCircle = new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Position = new Vector2(circle_offset, 0),
|
||||
Colour = OsuColour.FromHex(@"e967a1"),
|
||||
},
|
||||
};
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
line.Size = new Vector2(105, 1.5f);
|
||||
line.Alpha = 0;
|
||||
}
|
||||
|
||||
Scale = new Vector2(0.5f);
|
||||
}
|
||||
|
||||
public void Start(double length)
|
||||
{
|
||||
if (Children.Any())
|
||||
{
|
||||
// restart if we were already run previously.
|
||||
FinishTransforms(true);
|
||||
load();
|
||||
}
|
||||
|
||||
smallRing.ResizeTo(logo_size * 0.086f, 400, Easing.InOutQuint);
|
||||
|
||||
mediumRing.ResizeTo(130, 340, Easing.OutQuad);
|
||||
mediumRing.Foreground.ResizeTo(1, 880, Easing.Out);
|
||||
|
||||
Func<double> remainingTime = () => length - TransformDelay;
|
||||
|
||||
using (BeginDelayedSequence(250, true))
|
||||
{
|
||||
welcomeText.FadeIn(700);
|
||||
welcomeText.TransformSpacingTo(new Vector2(20, 0), remainingTime(), Easing.Out);
|
||||
|
||||
const int line_duration = 700;
|
||||
const int line_resize = 150;
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
line.FadeIn(40).ResizeWidthTo(0, line_duration - line_resize, Easing.OutQuint);
|
||||
}
|
||||
|
||||
const int line_end_offset = 120;
|
||||
|
||||
smallRing.Foreground.ResizeTo(1, line_duration, Easing.OutQuint);
|
||||
|
||||
lineTopLeft.MoveTo(new Vector2(-line_end_offset, -line_end_offset), line_duration, Easing.OutQuint);
|
||||
lineTopRight.MoveTo(new Vector2(line_end_offset, -line_end_offset), line_duration, Easing.OutQuint);
|
||||
lineBottomLeft.MoveTo(new Vector2(-line_end_offset, line_end_offset), line_duration, Easing.OutQuint);
|
||||
lineBottomRight.MoveTo(new Vector2(line_end_offset, line_end_offset), line_duration, Easing.OutQuint);
|
||||
|
||||
using (BeginDelayedSequence(length * 0.56, true))
|
||||
{
|
||||
bigRing.ResizeTo(logo_size, 500, Easing.InOutQuint);
|
||||
bigRing.Foreground.Delay(250).ResizeTo(1, 850, Easing.OutQuint);
|
||||
|
||||
using (BeginDelayedSequence(250, true))
|
||||
{
|
||||
backgroundFill.ResizeHeightTo(1, remainingTime(), Easing.InOutQuart);
|
||||
backgroundFill.RotateTo(-90, remainingTime(), Easing.InOutQuart);
|
||||
|
||||
using (BeginDelayedSequence(50, true))
|
||||
{
|
||||
foregroundFill.ResizeWidthTo(1, remainingTime(), Easing.InOutQuart);
|
||||
foregroundFill.RotateTo(-90, remainingTime(), Easing.InOutQuart);
|
||||
}
|
||||
|
||||
this.ScaleTo(1, remainingTime(), Easing.InOutCubic);
|
||||
|
||||
const float circle_size = logo_size * 0.9f;
|
||||
|
||||
const int rotation_delay = 110;
|
||||
const int appear_delay = 80;
|
||||
|
||||
purpleCircle.MoveToY(circle_size / 2, remainingTime(), Easing.InOutQuart);
|
||||
purpleCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart);
|
||||
purpleCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart);
|
||||
|
||||
using (BeginDelayedSequence(appear_delay, true))
|
||||
{
|
||||
yellowCircle.MoveToY(-circle_size / 2, remainingTime(), Easing.InOutQuart);
|
||||
yellowCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart);
|
||||
yellowCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart);
|
||||
|
||||
using (BeginDelayedSequence(appear_delay, true))
|
||||
{
|
||||
blueCircle.MoveToX(-circle_size / 2, remainingTime(), Easing.InOutQuart);
|
||||
blueCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart);
|
||||
blueCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart);
|
||||
|
||||
using (BeginDelayedSequence(appear_delay, true))
|
||||
{
|
||||
pinkCircle.MoveToX(circle_size / 2, remainingTime(), Easing.InOutQuart);
|
||||
pinkCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart);
|
||||
pinkCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Ring : Container<Circle>
|
||||
{
|
||||
public readonly Circle Foreground;
|
||||
|
||||
public Ring(Color4 ringColour, float foregroundSize)
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
Children = new[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Scale = new Vector2(0.98f),
|
||||
Colour = ringColour,
|
||||
},
|
||||
Foreground = new Circle
|
||||
{
|
||||
Size = new Vector2(foregroundSize),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
internal class LogoVisualisation : Drawable, IHasAccentColour
|
||||
public class LogoVisualisation : Drawable, IHasAccentColour
|
||||
{
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
|
@ -59,13 +59,16 @@ namespace osu.Game.Screens.Menu
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame game)
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game = null)
|
||||
{
|
||||
LoadComponentAsync(background);
|
||||
|
||||
buttons.OnSettings = game.ToggleSettings;
|
||||
buttons.OnDirect = game.ToggleDirect;
|
||||
if (game != null)
|
||||
{
|
||||
buttons.OnSettings = game.ToggleSettings;
|
||||
buttons.OnDirect = game.ToggleDirect;
|
||||
}
|
||||
|
||||
preloadSongSelect();
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ namespace osu.Game.Screens.Menu
|
||||
private readonly Container logoHoverContainer;
|
||||
private readonly LogoVisualisation visualizer;
|
||||
|
||||
private readonly IntroSequence intro;
|
||||
|
||||
private SampleChannel sampleClick;
|
||||
private SampleChannel sampleBeat;
|
||||
|
||||
@ -90,6 +92,10 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
intro = new IntroSequence
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
logoHoverContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
@ -269,6 +275,17 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayIntro()
|
||||
{
|
||||
const double length = 3150;
|
||||
const double fade = 200;
|
||||
|
||||
logoHoverContainer.FadeOut().Delay(length).FadeIn(fade);
|
||||
intro.Show();
|
||||
intro.Start(length);
|
||||
intro.Delay(length + fade).FadeOut();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
@ -655,6 +655,7 @@
|
||||
<Compile Include="Screens\Menu\Disclaimer.cs" />
|
||||
<Compile Include="Screens\Menu\FlowContainerWithOrigin.cs" />
|
||||
<Compile Include="Screens\Menu\Intro.cs" />
|
||||
<Compile Include="Screens\Menu\IntroSequence.cs" />
|
||||
<Compile Include="Screens\Menu\LogoVisualisation.cs" />
|
||||
<Compile Include="Screens\Menu\MainMenu.cs" />
|
||||
<Compile Include="Screens\Menu\MenuSideFlashes.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user