From 578c955658fb4846acb022b64d965896c9d0b897 Mon Sep 17 00:00:00 2001 From: Shivam Date: Tue, 2 Jun 2020 03:48:23 +0200 Subject: [PATCH] Add fallback intro screen --- .../Visual/Menus/TestSceneIntroFallback.cs | 15 +++++ osu.Game/Configuration/IntroSequence.cs | 1 + osu.Game/Screens/Loader.cs | 3 + osu.Game/Screens/Menu/IntroFallback.cs | 56 +++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 osu.Game.Tests/Visual/Menus/TestSceneIntroFallback.cs create mode 100644 osu.Game/Screens/Menu/IntroFallback.cs diff --git a/osu.Game.Tests/Visual/Menus/TestSceneIntroFallback.cs b/osu.Game.Tests/Visual/Menus/TestSceneIntroFallback.cs new file mode 100644 index 0000000000..cb32d6bf32 --- /dev/null +++ b/osu.Game.Tests/Visual/Menus/TestSceneIntroFallback.cs @@ -0,0 +1,15 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Screens; +using osu.Game.Screens.Menu; + +namespace osu.Game.Tests.Visual.Menus +{ + [TestFixture] + public class TestSceneIntroFallback : IntroTestScene + { + protected override IScreen CreateScreen() => new IntroFallback(); + } +} diff --git a/osu.Game/Configuration/IntroSequence.cs b/osu.Game/Configuration/IntroSequence.cs index 1ee7da8bac..24f8c0f048 100644 --- a/osu.Game/Configuration/IntroSequence.cs +++ b/osu.Game/Configuration/IntroSequence.cs @@ -6,6 +6,7 @@ namespace osu.Game.Configuration public enum IntroSequence { Circles, + Fallback, Triangles, Random } diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index a5b55a24e5..690868bd36 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -51,6 +51,9 @@ private IntroScreen getIntroSequence() case IntroSequence.Circles: return new IntroCircles(); + case IntroSequence.Fallback: + return new IntroFallback(); + default: return new IntroTriangles(); } diff --git a/osu.Game/Screens/Menu/IntroFallback.cs b/osu.Game/Screens/Menu/IntroFallback.cs new file mode 100644 index 0000000000..bc01e9c502 --- /dev/null +++ b/osu.Game/Screens/Menu/IntroFallback.cs @@ -0,0 +1,56 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Screens; +using osu.Framework.Graphics; + +namespace osu.Game.Screens.Menu +{ + public class IntroFallback : IntroScreen + { + protected override string BeatmapHash => "64E00D7022195959BFA3109D09C2E2276C8F12F486B91FCF6175583E973B48F2"; + protected override string BeatmapFile => "welcome.osz"; + private const double delay_step_two = 3000; + + private SampleChannel welcome; + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + if (MenuVoice.Value) + welcome = audio.Samples.Get(@"welcome"); + } + + protected override void LogoArriving(OsuLogo logo, bool resuming) + { + base.LogoArriving(logo, resuming); + + if (!resuming) + { + welcome?.Play(); + + Scheduler.AddDelayed(delegate + { + StartTrack(); + + PrepareMenuLoad(); + + Scheduler.AddDelayed(LoadMenu, 0); + }, delay_step_two); + + logo.ScaleTo(1); + logo.FadeIn(); + logo.PlayIntro(); + } + } + + public override void OnSuspending(IScreen next) + { + this.FadeOut(300); + base.OnSuspending(next); + } + } +}