1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 08:13:10 +08:00

Many fixes

This commit is contained in:
Dean Herbert 2017-11-03 17:54:35 +09:00
parent 2f205d1f63
commit 3adcfa8c38
5 changed files with 95 additions and 132 deletions

View File

@ -12,16 +12,16 @@ using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
public class TestCaseIntro : OsuTestCase public class TestCaseIntroSequence : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(IntroSequence) typeof(OsuLogo),
}; };
public TestCaseIntro() public TestCaseIntroSequence()
{ {
IntroSequence intro; OsuLogo logo;
var rateAdjustClock = new StopwatchClock(true); var rateAdjustClock = new StopwatchClock(true);
var framedClock = new FramedClock(rateAdjustClock); var framedClock = new FramedClock(rateAdjustClock);
@ -38,11 +38,14 @@ namespace osu.Game.Tests.Visual
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black, Colour = Color4.Black,
}, },
intro = new IntroSequence(), logo = new OsuLogo
{
Anchor = Anchor.Centre,
}
} }
}); });
AddStep(@"Restart", intro.Restart); AddStep(@"Restart", logo.PlayIntro);
AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v); AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
} }
} }

View File

@ -110,7 +110,7 @@
<Compile Include="Visual\TestCaseGamefield.cs" /> <Compile Include="Visual\TestCaseGamefield.cs" />
<Compile Include="Visual\TestCaseGraph.cs" /> <Compile Include="Visual\TestCaseGraph.cs" />
<Compile Include="Visual\TestCaseIconButton.cs" /> <Compile Include="Visual\TestCaseIconButton.cs" />
<Compile Include="Visual\TestCaseIntro.cs" /> <Compile Include="Visual\TestCaseIntroSequence.cs" />
<Compile Include="Visual\TestCaseKeyConfiguration.cs" /> <Compile Include="Visual\TestCaseKeyConfiguration.cs" />
<Compile Include="Visual\TestCaseKeyCounter.cs" /> <Compile Include="Visual\TestCaseKeyCounter.cs" />
<Compile Include="Visual\TestCaseLeaderboard.cs" /> <Compile Include="Visual\TestCaseLeaderboard.cs" />

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;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
@ -15,12 +16,10 @@ namespace osu.Game.Screens.Menu
public class IntroSequence : Container public class IntroSequence : Container
{ {
//Size //Size
private const int logo_size = 460; //todo: this should probably be 480 private const float logo_size = 460; //todo: this should probably be 480
private readonly OsuSpriteText welcomeText; private readonly OsuSpriteText welcomeText;
private readonly OsuLogo logo;
private readonly Container barsContainer; private readonly Container barsContainer;
private readonly Container barTopLeft; private readonly Container barTopLeft;
@ -185,144 +184,95 @@ namespace osu.Game.Screens.Menu
Colour = OsuColour.FromHex(@"e967a1"), Colour = OsuColour.FromHex(@"e967a1"),
} }
}, },
logo = new OsuLogo
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Ripple = false,
Interactive = false,
Blending = BlendingMode.Additive,
},
}; };
setDefaults();
} }
public void Start() public void Start(double length)
{ {
const int circle_size = 416; FinishTransforms(true);
setDefaults();
//Time mediumRing.ResizeTo(130, 360, Easing.InExpo).OnComplete(r => r.Foreground.ResizeTo(1, 420, Easing.OutQuad));
const int full_animation_duration = 2950;
const int medium_ring_resize_duration = 360; Func<double> remainingTime = () => length - TransformDelay;
const int medium_ring_fade_duration = 420;
const int small_ring_resize_duration = 250;
const int small_ring_fade_duration = 650;
const int text_fade_duration = 700;
const int text_spacing_transform_duration = 1500;
const int bar_animation_duration = 700;
const int bar_resize_delay = 150;
const int big_ring_animation_start_delay = 2000;
const int big_ring_resize_duration = 500;
const int big_ring_foreground_resize_delay = 250;
const int big_ring_fade_duration = 450;
const int background_animation_start_time = 2250;
const int foreground_animation_start_time = 2300;
const int colored_circle_rotation_delay = 110;
const int colored_circles_appear_delay = 80;
const int purple_circle_animation_start_time = 2250;
const int logo_fade_duration = 300;
//Position
const int bar_end_offset = 120;
mediumRing.ResizeTo(130, medium_ring_resize_duration, Easing.InExpo);
using (BeginDelayedSequence(200, true)) using (BeginDelayedSequence(200, true))
{ {
welcomeText.FadeIn(text_fade_duration); welcomeText.FadeIn(700);
welcomeText.TransformSpacingTo(new Vector2(20, 0), text_spacing_transform_duration, Easing.Out); welcomeText.TransformSpacingTo(new Vector2(20, 0), 1500, Easing.Out);
smallRing.ResizeTo(40, small_ring_resize_duration, Easing.InExpo); smallRing.ResizeTo(logo_size * 0.086f, 250, Easing.InExpo).OnComplete(r => r.Foreground.ResizeTo(1, 650, Easing.OutQuad));
smallRing.Foreground.Delay(small_ring_resize_duration).ResizeTo(1, small_ring_fade_duration, Easing.OutQuad);
}
using (BeginDelayedSequence(medium_ring_resize_duration, true)) using (BeginDelayedSequence(160, true))
{ {
mediumRing.Foreground.ResizeTo(1, medium_ring_fade_duration, Easing.OutQuad); const int bar_duration = 700;
const int bar_resize = 150;
foreach (var bar in barsContainer) foreach (var bar in barsContainer)
{ {
bar.FadeIn(); bar.FadeIn();
bar.Delay(bar_resize_delay).ResizeWidthTo(0, bar_animation_duration - bar_resize_delay, Easing.OutQuint); bar.Delay(bar_resize).ResizeWidthTo(0, bar_duration - bar_resize, Easing.OutQuint);
} }
barTopLeft.MoveTo(new Vector2(-bar_end_offset, -bar_end_offset), bar_animation_duration, Easing.OutQuint); const int bar_end_offset = 120;
barTopRight.MoveTo(new Vector2(bar_end_offset, -bar_end_offset), bar_animation_duration, Easing.OutQuint); barTopLeft.MoveTo(new Vector2(-bar_end_offset, -bar_end_offset), bar_duration, Easing.OutQuint);
barBottomLeft.MoveTo(new Vector2(-bar_end_offset, bar_end_offset), bar_animation_duration, Easing.OutQuint); barTopRight.MoveTo(new Vector2(bar_end_offset, -bar_end_offset), bar_duration, Easing.OutQuint);
barBottomRight.MoveTo(new Vector2(bar_end_offset, bar_end_offset), bar_animation_duration, Easing.OutQuint); barBottomLeft.MoveTo(new Vector2(-bar_end_offset, bar_end_offset), bar_duration, Easing.OutQuint);
} barBottomRight.MoveTo(new Vector2(bar_end_offset, bar_end_offset), bar_duration, Easing.OutQuint);
using (bigRing.BeginDelayedSequence(big_ring_animation_start_delay, true)) using (BeginDelayedSequence(1640, true)) // 2000
{ {
bigRing.ResizeTo(400, big_ring_resize_duration, Easing.InOutQuint); bigRing.ResizeTo(logo_size * 0.86f, 500, Easing.InOutQuint);
bigRing.Foreground.Delay(big_ring_foreground_resize_delay).ResizeTo(1, big_ring_fade_duration, Easing.OutExpo); bigRing.Foreground.Delay(250).ResizeTo(1, 450, Easing.OutExpo);
}
int duration = full_animation_duration - background_animation_start_time; using (BeginDelayedSequence(250, true)) // 2250
using (backgroundFill.BeginDelayedSequence(background_animation_start_time))
{ {
backgroundFill.ResizeHeightTo(1, duration, Easing.InOutQuart); backgroundFill.ResizeHeightTo(1, remainingTime(), Easing.InOutQuart);
backgroundFill.RotateTo(-90, duration, Easing.InOutQuart); backgroundFill.RotateTo(-90, remainingTime(), Easing.InOutQuart);
}
duration = full_animation_duration - foreground_animation_start_time; using (BeginDelayedSequence(50, true))
using (foregroundFill.BeginDelayedSequence(foreground_animation_start_time))
{ {
foregroundFill.ResizeWidthTo(1, duration, Easing.InOutQuart); foregroundFill.ResizeWidthTo(1, remainingTime(), Easing.InOutQuart);
foregroundFill.RotateTo(-90, duration, Easing.InOutQuart); foregroundFill.RotateTo(-90, remainingTime(), Easing.InOutQuart);
} }
duration = full_animation_duration - purple_circle_animation_start_time; const float circle_size = logo_size * 0.9f;
using (BeginDelayedSequence(purple_circle_animation_start_time, true))
const int rotation_delay = 110;
const int appear_delay = 80;
purpleCircle.MoveToY(circle_size / 2, remainingTime(), Easing.InOutQuad);
purpleCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.OutQuad);
purpleCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuad);
using (BeginDelayedSequence(appear_delay, true))
{ {
purpleCircle.MoveToY((circle_size - 2) / 2.0f, duration, Easing.InOutQuad); yellowCircle.MoveToY(-circle_size / 2, remainingTime(), Easing.InOutQuad);
purpleCircle.Delay(colored_circle_rotation_delay).RotateTo(-180, duration - colored_circle_rotation_delay, Easing.OutQuad); yellowCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.OutQuad);
purpleCircle.ResizeTo(circle_size - 2, duration, Easing.InOutQuad); yellowCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuad);
duration -= colored_circles_appear_delay; using (BeginDelayedSequence(appear_delay, true))
using (BeginDelayedSequence(colored_circles_appear_delay, true))
{ {
yellowCircle.MoveToY(-(circle_size - 2) / 2.0f, duration, Easing.InOutQuad); blueCircle.MoveToX(-circle_size / 2, remainingTime(), Easing.InOutQuad);
yellowCircle.Delay(colored_circle_rotation_delay).RotateTo(-180, duration - colored_circle_rotation_delay, Easing.OutQuad); blueCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.OutQuad);
yellowCircle.ResizeTo(circle_size - 2, duration, Easing.InOutQuad); blueCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuad);
duration -= colored_circles_appear_delay; using (BeginDelayedSequence(appear_delay, true))
using (BeginDelayedSequence(colored_circles_appear_delay, true))
{ {
blueCircle.MoveToX(-(circle_size - 2) / 2.0f, duration, Easing.InOutQuad); pinkCircle.MoveToX(circle_size / 2, remainingTime(), Easing.InOutQuad);
blueCircle.Delay(colored_circle_rotation_delay).RotateTo(-180, duration - colored_circle_rotation_delay, Easing.OutQuad); pinkCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.OutQuad);
blueCircle.ResizeTo(circle_size - 2, duration, Easing.InOutQuad); pinkCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuad);
}
duration -= colored_circles_appear_delay; }
using (BeginDelayedSequence(colored_circles_appear_delay, true)) }
{
pinkCircle.MoveToX(circle_size / 2.0f, duration, Easing.InOutQuad);
pinkCircle.Delay(colored_circle_rotation_delay).RotateTo(-180, duration - colored_circle_rotation_delay, Easing.OutQuad);
pinkCircle.ResizeTo(circle_size, duration, Easing.InOutQuad);
} }
} }
} }
} }
logo.Delay(full_animation_duration).FadeIn(logo_fade_duration);
backgroundFill.Delay(full_animation_duration + logo_fade_duration).FadeOut();
foregroundFill.Delay(full_animation_duration + logo_fade_duration).FadeOut();
} }
private void setDefaults() private void setDefaults()
{ {
logo.Alpha = 0;
welcomeText.Spacing = new Vector2(5); welcomeText.Spacing = new Vector2(5);
welcomeText.Alpha = 0; welcomeText.Alpha = 0;
@ -355,13 +305,6 @@ namespace osu.Game.Screens.Menu
pinkCircle.Position = new Vector2(circle_offset, 0); pinkCircle.Position = new Vector2(circle_offset, 0);
} }
public void Restart()
{
FinishTransforms(true);
setDefaults();
Start();
}
private class Ring : Container<CircularContainer> private class Ring : Container<CircularContainer>
{ {
public readonly CircularContainer Foreground; public readonly CircularContainer Foreground;

View File

@ -19,7 +19,7 @@ using osu.Framework.Allocation;
namespace osu.Game.Screens.Menu namespace osu.Game.Screens.Menu
{ {
internal class LogoVisualisation : Drawable, IHasAccentColour public class LogoVisualisation : Drawable, IHasAccentColour
{ {
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>(); private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();

View File

@ -39,6 +39,8 @@ namespace osu.Game.Screens.Menu
private readonly Container logoHoverContainer; private readonly Container logoHoverContainer;
private readonly LogoVisualisation visualizer; private readonly LogoVisualisation visualizer;
private readonly IntroSequence intro;
private SampleChannel sampleClick; private SampleChannel sampleClick;
private SampleChannel sampleBeat; private SampleChannel sampleBeat;
@ -89,6 +91,10 @@ namespace osu.Game.Screens.Menu
Children = new Drawable[] Children = new Drawable[]
{ {
intro = new IntroSequence
{
RelativeSizeAxes = Axes.Both,
},
logoHoverContainer = new Container logoHoverContainer = new Container
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
@ -289,6 +295,17 @@ namespace osu.Game.Screens.Menu
} }
} }
public void PlayIntro()
{
const double length = 2950;
const double fade = 300;
logoHoverContainer.FadeOut().Delay(length).FadeIn(fade);
intro.Show();
intro.Start(length);
intro.Delay(length + fade).FadeOut();
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();