mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:42:58 +08:00
Allow intro screens to be created without loading a MainMenu
This commit is contained in:
parent
acaef26af7
commit
f88d898960
@ -49,14 +49,16 @@ namespace osu.Game.Screens
|
||||
switch (introSequence)
|
||||
{
|
||||
case IntroSequence.Circles:
|
||||
return new IntroCircles();
|
||||
return new IntroCircles(createMainMenu);
|
||||
|
||||
case IntroSequence.Welcome:
|
||||
return new IntroWelcome();
|
||||
return new IntroWelcome(createMainMenu);
|
||||
|
||||
default:
|
||||
return new IntroTriangles();
|
||||
return new IntroTriangles(createMainMenu);
|
||||
}
|
||||
|
||||
MainMenu createMainMenu() => new MainMenu();
|
||||
}
|
||||
|
||||
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -20,6 +22,11 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private Sample welcome;
|
||||
|
||||
public IntroCircles([CanBeNull] Func<MainMenu> createNextScreen = null)
|
||||
: base(createNextScreen)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
|
@ -1,15 +1,17 @@
|
||||
// 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;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.IO.Archives;
|
||||
@ -55,7 +57,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private LeasedBindable<WorkingBeatmap> beatmap;
|
||||
|
||||
private MainMenu mainMenu;
|
||||
private OsuScreen nextScreen;
|
||||
|
||||
[Resolved]
|
||||
private AudioManager audio { get; set; }
|
||||
@ -63,12 +65,20 @@ namespace osu.Game.Screens.Menu
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; }
|
||||
|
||||
[CanBeNull]
|
||||
private readonly Func<OsuScreen> createNextScreen;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
|
||||
/// Only valid during or after <see cref="LogoArriving"/>.
|
||||
/// </summary>
|
||||
protected bool UsingThemedIntro { get; private set; }
|
||||
|
||||
protected IntroScreen([CanBeNull] Func<MainMenu> createNextScreen = null)
|
||||
{
|
||||
this.createNextScreen = createNextScreen;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
|
||||
{
|
||||
@ -214,14 +224,21 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
}
|
||||
|
||||
protected void PrepareMenuLoad() => LoadComponentAsync(mainMenu = new MainMenu());
|
||||
protected void PrepareMenuLoad()
|
||||
{
|
||||
nextScreen = createNextScreen?.Invoke();
|
||||
|
||||
if (nextScreen != null)
|
||||
LoadComponentAsync(nextScreen);
|
||||
}
|
||||
|
||||
protected void LoadMenu()
|
||||
{
|
||||
beatmap.Return();
|
||||
|
||||
DidLoadMenu = true;
|
||||
this.Push(mainMenu);
|
||||
if (nextScreen != null)
|
||||
this.Push(nextScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -44,6 +45,11 @@ namespace osu.Game.Screens.Menu
|
||||
private DecoupleableInterpolatingFramedClock decoupledClock;
|
||||
private TrianglesIntroSequence intro;
|
||||
|
||||
public IntroTriangles([CanBeNull] Func<MainMenu> createNextScreen = null)
|
||||
: base(createNextScreen)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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;
|
||||
using JetBrains.Annotations;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -32,6 +34,11 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private BackgroundScreenDefault background;
|
||||
|
||||
public IntroWelcome([CanBeNull] Func<MainMenu> createNextScreen = null)
|
||||
: base(createNextScreen)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user