2017-02-07 12:59:30 +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
|
2016-10-06 20:10:01 +08:00
|
|
|
|
|
2016-11-14 16:23:33 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Audio;
|
2016-10-06 20:10:01 +08:00
|
|
|
|
using osu.Framework.Audio.Sample;
|
|
|
|
|
using osu.Framework.Audio.Track;
|
|
|
|
|
using osu.Framework.GameModes;
|
2016-10-07 16:07:23 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Transformations;
|
2016-12-01 20:59:32 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2016-11-14 16:23:33 +08:00
|
|
|
|
using osu.Game.Screens.Backgrounds;
|
2016-10-07 16:07:23 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2016-10-06 20:10:01 +08:00
|
|
|
|
|
2016-11-14 16:23:33 +08:00
|
|
|
|
namespace osu.Game.Screens.Menu
|
2016-10-06 20:10:01 +08:00
|
|
|
|
{
|
|
|
|
|
class Intro : OsuGameMode
|
|
|
|
|
{
|
2016-10-07 16:07:23 +08:00
|
|
|
|
private OsuLogo logo;
|
2016-10-07 18:12:36 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether we have loaded the menu previously.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal bool DidLoadMenu;
|
2016-10-07 17:58:20 +08:00
|
|
|
|
|
2016-11-01 22:24:14 +08:00
|
|
|
|
MainMenu mainMenu;
|
|
|
|
|
private AudioSample welcome;
|
2016-12-05 18:34:52 +08:00
|
|
|
|
private AudioSample seeya;
|
2016-11-01 22:24:14 +08:00
|
|
|
|
private AudioTrack bgm;
|
|
|
|
|
|
2016-11-15 19:43:43 +08:00
|
|
|
|
internal override bool ShowOverlays => (ParentGameMode as OsuGameMode)?.ShowOverlays ?? false;
|
2016-11-09 14:22:54 +08:00
|
|
|
|
|
2016-10-06 22:32:35 +08:00
|
|
|
|
protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty();
|
|
|
|
|
|
2016-11-01 22:24:14 +08:00
|
|
|
|
public Intro()
|
2016-10-06 20:10:01 +08:00
|
|
|
|
{
|
2016-10-07 16:07:23 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2016-12-01 20:59:32 +08:00
|
|
|
|
new ParallaxContainer
|
2016-10-07 16:07:23 +08:00
|
|
|
|
{
|
2016-12-01 20:59:32 +08:00
|
|
|
|
ParallaxAmount = 0.01f,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
logo = new OsuLogo
|
|
|
|
|
{
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
Triangles = false,
|
|
|
|
|
BlendingMode = BlendingMode.Additive,
|
|
|
|
|
Interactive = false,
|
|
|
|
|
Colour = Color4.DarkGray,
|
|
|
|
|
Ripple = false
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-07 16:07:23 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
2016-11-01 22:24:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-12 18:44:16 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(AudioManager audio)
|
2016-11-01 22:24:14 +08:00
|
|
|
|
{
|
2016-11-09 07:13:20 +08:00
|
|
|
|
welcome = audio.Sample.Get(@"welcome");
|
2016-12-05 18:34:52 +08:00
|
|
|
|
seeya = audio.Sample.Get(@"seeya");
|
2016-10-07 16:07:23 +08:00
|
|
|
|
|
2016-11-09 07:13:20 +08:00
|
|
|
|
bgm = audio.Track.Get(@"circles");
|
2016-10-06 20:10:01 +08:00
|
|
|
|
bgm.Looping = true;
|
2016-11-01 22:24:14 +08:00
|
|
|
|
}
|
2016-10-06 20:10:01 +08:00
|
|
|
|
|
2017-01-20 16:28:03 +08:00
|
|
|
|
protected override void OnEntering(GameMode last)
|
2016-11-01 22:24:14 +08:00
|
|
|
|
{
|
2017-01-20 16:28:03 +08:00
|
|
|
|
base.OnEntering(last);
|
|
|
|
|
|
2016-10-08 17:33:24 +08:00
|
|
|
|
Scheduler.Add(delegate
|
2016-10-07 16:07:23 +08:00
|
|
|
|
{
|
|
|
|
|
welcome.Play();
|
|
|
|
|
|
2016-11-02 00:02:48 +08:00
|
|
|
|
Scheduler.AddDelayed(delegate
|
|
|
|
|
{
|
|
|
|
|
bgm.Start();
|
2016-10-06 20:10:01 +08:00
|
|
|
|
|
2016-11-02 00:02:48 +08:00
|
|
|
|
mainMenu = new MainMenu();
|
|
|
|
|
mainMenu.Preload(Game);
|
|
|
|
|
|
|
|
|
|
Scheduler.AddDelayed(delegate
|
|
|
|
|
{
|
|
|
|
|
DidLoadMenu = true;
|
|
|
|
|
Push(mainMenu);
|
|
|
|
|
}, 2300);
|
|
|
|
|
}, 600);
|
|
|
|
|
});
|
2016-10-07 16:07:23 +08:00
|
|
|
|
|
2016-11-01 22:24:14 +08:00
|
|
|
|
logo.ScaleTo(0.4f);
|
|
|
|
|
logo.FadeOut();
|
|
|
|
|
|
|
|
|
|
logo.ScaleTo(1, 4400, EasingTypes.OutQuint);
|
|
|
|
|
logo.FadeIn(20000, EasingTypes.OutQuint);
|
2016-10-07 16:07:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnSuspending(GameMode next)
|
|
|
|
|
{
|
|
|
|
|
Content.FadeOut(300);
|
|
|
|
|
base.OnSuspending(next);
|
2016-10-06 20:10:01 +08:00
|
|
|
|
}
|
2016-10-07 17:34:37 +08:00
|
|
|
|
|
2016-10-07 17:58:20 +08:00
|
|
|
|
protected override bool OnExiting(GameMode next)
|
|
|
|
|
{
|
|
|
|
|
//cancel exiting if we haven't loaded the menu yet.
|
2016-10-07 18:12:36 +08:00
|
|
|
|
return !DidLoadMenu;
|
2016-10-07 17:58:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-07 17:34:37 +08:00
|
|
|
|
protected override void OnResuming(GameMode last)
|
|
|
|
|
{
|
2016-12-05 18:34:52 +08:00
|
|
|
|
//we also handle the exit transition.
|
|
|
|
|
seeya.Play();
|
|
|
|
|
|
|
|
|
|
double fadeOutTime = (last.LifetimeEnd - Time.Current) + 100;
|
|
|
|
|
|
|
|
|
|
Scheduler.AddDelayed(Exit, fadeOutTime);
|
|
|
|
|
|
|
|
|
|
//don't want to fade out completely else we will stop running updates and shit will hit the fan.
|
|
|
|
|
Game.FadeTo(0.01f, fadeOutTime);
|
2016-10-07 17:34:37 +08:00
|
|
|
|
|
|
|
|
|
base.OnResuming(last);
|
|
|
|
|
}
|
2016-10-06 20:10:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|