2017-02-07 04:59:30 +00: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 12:10:01 +00:00
|
|
|
|
|
2016-11-14 08:23:33 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Audio;
|
2016-10-06 12:10:01 +00:00
|
|
|
|
using osu.Framework.Audio.Sample;
|
|
|
|
|
using osu.Framework.Audio.Track;
|
2017-04-14 17:42:42 +00:00
|
|
|
|
using osu.Framework.Configuration;
|
2017-02-17 09:59:30 +00:00
|
|
|
|
using osu.Framework.Screens;
|
2016-10-07 08:07:23 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-04-14 17:42:42 +00:00
|
|
|
|
using osu.Game.Configuration;
|
2016-12-01 12:59:32 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2016-11-14 08:23:33 +00:00
|
|
|
|
using osu.Game.Screens.Backgrounds;
|
2016-10-07 08:07:23 +00:00
|
|
|
|
using OpenTK.Graphics;
|
2016-10-06 12:10:01 +00:00
|
|
|
|
|
2016-11-14 08:23:33 +00:00
|
|
|
|
namespace osu.Game.Screens.Menu
|
2016-10-06 12:10:01 +00:00
|
|
|
|
{
|
2017-02-18 05:16:46 +00:00
|
|
|
|
public class Intro : OsuScreen
|
2016-10-06 12:10:01 +00:00
|
|
|
|
{
|
2017-03-23 04:41:50 +00:00
|
|
|
|
private readonly OsuLogo logo;
|
2016-10-07 10:12:36 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether we have loaded the menu previously.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal bool DidLoadMenu;
|
2016-10-07 09:58:20 +00:00
|
|
|
|
|
2017-03-07 01:59:19 +00:00
|
|
|
|
private MainMenu mainMenu;
|
2017-02-18 08:35:04 +00:00
|
|
|
|
private SampleChannel welcome;
|
|
|
|
|
private SampleChannel seeya;
|
|
|
|
|
private Track bgm;
|
2016-11-01 14:24:14 +00:00
|
|
|
|
|
2017-03-16 14:58:36 +00:00
|
|
|
|
internal override bool HasLocalCursorDisplayed => true;
|
|
|
|
|
|
2017-02-17 11:07:11 +00:00
|
|
|
|
internal override bool ShowOverlays => false;
|
2016-11-09 06:22:54 +00:00
|
|
|
|
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
|
2016-10-06 14:32:35 +00:00
|
|
|
|
|
2016-11-01 14:24:14 +00:00
|
|
|
|
public Intro()
|
2016-10-06 12:10:01 +00:00
|
|
|
|
{
|
2016-10-07 08:07:23 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2016-12-01 12:59:32 +00:00
|
|
|
|
new ParallaxContainer
|
2016-10-07 08:07:23 +00:00
|
|
|
|
{
|
2016-12-01 12:59:32 +00: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 08:07:23 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2016-11-01 14:24:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-14 17:42:42 +00:00
|
|
|
|
private Bindable<bool> menuVoice;
|
2017-04-14 18:10:59 +00:00
|
|
|
|
private Bindable<bool> menuMusic;
|
2017-04-14 17:42:42 +00:00
|
|
|
|
|
2016-11-12 10:44:16 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
2017-04-23 05:57:41 +00:00
|
|
|
|
private void load(AudioManager audio, OsuConfigManager config)
|
2016-11-01 14:24:14 +00:00
|
|
|
|
{
|
2017-04-14 17:42:42 +00:00
|
|
|
|
menuVoice = config.GetBindable<bool>(OsuConfig.MenuVoice);
|
2017-04-14 18:10:59 +00:00
|
|
|
|
menuMusic = config.GetBindable<bool>(OsuConfig.MenuMusic);
|
2017-04-14 17:42:42 +00:00
|
|
|
|
|
2017-04-14 18:10:59 +00:00
|
|
|
|
bgm = audio.Track.Get(@"circles");
|
|
|
|
|
bgm.Looping = true;
|
2017-04-14 17:42:42 +00:00
|
|
|
|
|
2017-04-14 18:10:59 +00:00
|
|
|
|
welcome = audio.Sample.Get(@"welcome");
|
2016-12-05 10:34:52 +00:00
|
|
|
|
seeya = audio.Sample.Get(@"seeya");
|
2016-11-01 14:24:14 +00:00
|
|
|
|
}
|
2016-10-06 12:10:01 +00:00
|
|
|
|
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override void OnEntering(Screen last)
|
2016-11-01 14:24:14 +00:00
|
|
|
|
{
|
2017-01-20 08:28:03 +00:00
|
|
|
|
base.OnEntering(last);
|
|
|
|
|
|
2017-04-25 03:48:25 +00:00
|
|
|
|
if (menuVoice)
|
2017-04-14 17:42:42 +00:00
|
|
|
|
welcome.Play();
|
2017-04-14 22:17:51 +00:00
|
|
|
|
|
2017-02-26 12:15:33 +00:00
|
|
|
|
Scheduler.AddDelayed(delegate
|
2016-10-07 08:07:23 +00:00
|
|
|
|
{
|
2017-04-25 03:48:25 +00:00
|
|
|
|
if (menuMusic)
|
2017-04-14 17:42:42 +00:00
|
|
|
|
bgm.Start();
|
2017-02-26 12:15:33 +00:00
|
|
|
|
|
2017-04-02 06:56:12 +00:00
|
|
|
|
LoadComponentAsync(mainMenu = new MainMenu());
|
2016-10-07 08:07:23 +00:00
|
|
|
|
|
2016-11-01 16:02:48 +00:00
|
|
|
|
Scheduler.AddDelayed(delegate
|
|
|
|
|
{
|
2017-02-26 12:15:33 +00:00
|
|
|
|
DidLoadMenu = true;
|
|
|
|
|
Push(mainMenu);
|
|
|
|
|
}, 2300);
|
|
|
|
|
}, 600);
|
2016-10-07 08:07:23 +00:00
|
|
|
|
|
2016-11-01 14:24:14 +00:00
|
|
|
|
logo.ScaleTo(0.4f);
|
|
|
|
|
logo.FadeOut();
|
|
|
|
|
|
|
|
|
|
logo.ScaleTo(1, 4400, EasingTypes.OutQuint);
|
|
|
|
|
logo.FadeIn(20000, EasingTypes.OutQuint);
|
2016-10-07 08:07:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override void OnSuspending(Screen next)
|
2016-10-07 08:07:23 +00:00
|
|
|
|
{
|
|
|
|
|
Content.FadeOut(300);
|
|
|
|
|
base.OnSuspending(next);
|
2016-10-06 12:10:01 +00:00
|
|
|
|
}
|
2016-10-07 09:34:37 +00:00
|
|
|
|
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override bool OnExiting(Screen next)
|
2016-10-07 09:58:20 +00:00
|
|
|
|
{
|
|
|
|
|
//cancel exiting if we haven't loaded the menu yet.
|
2016-10-07 10:12:36 +00:00
|
|
|
|
return !DidLoadMenu;
|
2016-10-07 09:58:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-17 09:59:30 +00:00
|
|
|
|
protected override void OnResuming(Screen last)
|
2016-10-07 09:34:37 +00:00
|
|
|
|
{
|
2017-02-17 06:33:08 +00:00
|
|
|
|
if (!(last is MainMenu))
|
|
|
|
|
Content.FadeIn(300);
|
|
|
|
|
|
2017-04-14 17:42:42 +00:00
|
|
|
|
double fadeOutTime = 2000;
|
2016-12-05 10:34:52 +00:00
|
|
|
|
//we also handle the exit transition.
|
2017-04-14 17:42:42 +00:00
|
|
|
|
if (menuVoice)
|
|
|
|
|
seeya.Play();
|
|
|
|
|
else
|
|
|
|
|
fadeOutTime = 500;
|
2016-12-05 10:34:52 +00:00
|
|
|
|
|
2017-04-14 17:42:42 +00:00
|
|
|
|
Scheduler.AddDelayed(Exit, fadeOutTime);
|
2016-12-05 10:34:52 +00:00
|
|
|
|
|
|
|
|
|
//don't want to fade out completely else we will stop running updates and shit will hit the fan.
|
2017-04-14 17:42:42 +00:00
|
|
|
|
Game.FadeTo(0.01f, fadeOutTime);
|
2016-10-07 09:34:37 +00:00
|
|
|
|
|
|
|
|
|
base.OnResuming(last);
|
|
|
|
|
}
|
2016-10-06 12:10:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|