mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 23:12: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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using osuTK;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
@ -22,7 +27,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
seeya = audio.Samples.Get(@"Intro/seeya-fallback");
|
Seeya = audio.Samples.Get(@"Intro/seeya-fallback");
|
||||||
|
|
||||||
if (MenuVoice.Value)
|
if (MenuVoice.Value)
|
||||||
{
|
{
|
||||||
@ -45,13 +50,20 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
PrepareMenuLoad();
|
PrepareMenuLoad();
|
||||||
|
|
||||||
Scheduler.Add(LoadMenu);
|
logo.ScaleTo(1);
|
||||||
|
logo.FadeIn();
|
||||||
|
|
||||||
|
Scheduler.Add(LoadMenu);
|
||||||
}, delay_step_two);
|
}, delay_step_two);
|
||||||
|
|
||||||
logo.ScaleTo(1);
|
LoadComponentAsync(new FallbackIntroSequence
|
||||||
logo.FadeIn();
|
{
|
||||||
logo.PlayIntro();
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}, t =>
|
||||||
|
{
|
||||||
|
AddInternal(t);
|
||||||
|
t.Start(delay_step_two);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,5 +72,46 @@ namespace osu.Game.Screens.Menu
|
|||||||
this.FadeOut(300);
|
this.FadeOut(300);
|
||||||
base.OnSuspending(next);
|
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;
|
private const int exit_delay = 3000;
|
||||||
|
|
||||||
protected SampleChannel seeya { get; set; }
|
protected SampleChannel Seeya { get; set; }
|
||||||
|
|
||||||
private LeasedBindable<WorkingBeatmap> beatmap;
|
private LeasedBindable<WorkingBeatmap> beatmap;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||||
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||||
|
|
||||||
seeya = audio.Samples.Get(@"Intro/seeya-lazer");
|
Seeya = audio.Samples.Get(@"Intro/seeya-lazer");
|
||||||
|
|
||||||
BeatmapSetInfo setInfo = null;
|
BeatmapSetInfo setInfo = null;
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
double fadeOutTime = exit_delay;
|
double fadeOutTime = exit_delay;
|
||||||
// we also handle the exit transition.
|
// we also handle the exit transition.
|
||||||
if (MenuVoice.Value)
|
if (MenuVoice.Value)
|
||||||
seeya.Play();
|
Seeya.Play();
|
||||||
else
|
else
|
||||||
fadeOutTime = 500;
|
fadeOutTime = 500;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user