mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
Implement basic intro sequence
This commit is contained in:
parent
3ae97c9634
commit
19d73af90d
@ -1,11 +1,16 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
@ -22,8 +27,8 @@ namespace osu.Game.Screens.Menu
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
seeya = audio.Samples.Get(@"Intro/seeya-fallback");
|
||||
|
||||
Seeya = audio.Samples.Get(@"Intro/seeya-fallback");
|
||||
|
||||
if (MenuVoice.Value)
|
||||
{
|
||||
welcome = audio.Samples.Get(@"Intro/welcome-fallback");
|
||||
@ -45,13 +50,20 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
PrepareMenuLoad();
|
||||
|
||||
logo.ScaleTo(1);
|
||||
logo.FadeIn();
|
||||
|
||||
Scheduler.Add(LoadMenu);
|
||||
|
||||
}, delay_step_two);
|
||||
|
||||
logo.ScaleTo(1);
|
||||
logo.FadeIn();
|
||||
logo.PlayIntro();
|
||||
LoadComponentAsync(new FallbackIntroSequence
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
}, t =>
|
||||
{
|
||||
AddInternal(t);
|
||||
t.Start(delay_step_two);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,5 +72,46 @@ namespace osu.Game.Screens.Menu
|
||||
this.FadeOut(300);
|
||||
base.OnSuspending(next);
|
||||
}
|
||||
|
||||
private class FallbackIntroSequence : Container
|
||||
{
|
||||
private OsuSpriteText welcomeText;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
welcomeText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = "welcome",
|
||||
Padding = new MarginPadding { Bottom = 10 },
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42),
|
||||
Alpha = 0,
|
||||
Spacing = new Vector2(5),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public void Start(double length)
|
||||
{
|
||||
if (Children.Any())
|
||||
{
|
||||
// restart if we were already run previously.
|
||||
FinishTransforms(true);
|
||||
load();
|
||||
}
|
||||
|
||||
double remainingTime() => length - TransformDelay;
|
||||
|
||||
using (BeginDelayedSequence(250, true))
|
||||
{
|
||||
welcomeText.FadeIn(700);
|
||||
welcomeText.ScaleTo(welcomeText.Scale + new Vector2(0.5f), remainingTime(), Easing.Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private const int exit_delay = 3000;
|
||||
|
||||
protected SampleChannel seeya { get; set; }
|
||||
protected SampleChannel Seeya { get; set; }
|
||||
|
||||
private LeasedBindable<WorkingBeatmap> beatmap;
|
||||
|
||||
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Menu
|
||||
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||
|
||||
seeya = audio.Samples.Get(@"Intro/seeya-lazer");
|
||||
Seeya = audio.Samples.Get(@"Intro/seeya-lazer");
|
||||
|
||||
BeatmapSetInfo setInfo = null;
|
||||
|
||||
@ -103,7 +103,7 @@ namespace osu.Game.Screens.Menu
|
||||
double fadeOutTime = exit_delay;
|
||||
// we also handle the exit transition.
|
||||
if (MenuVoice.Value)
|
||||
seeya.Play();
|
||||
Seeya.Play();
|
||||
else
|
||||
fadeOutTime = 500;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user