Reorder file contents

This commit is contained in:
Dean Herbert 2019-10-08 12:05:52 +09:00
parent a0bb193342
commit 4ba2dccde3
1 changed files with 33 additions and 40 deletions

View File

@ -21,6 +21,11 @@ namespace osu.Game.Screens.Menu
{ {
public abstract class IntroScreen : StartupScreen public abstract class IntroScreen : StartupScreen
{ {
/// <summary>
/// Whether we have loaded the menu previously.
/// </summary>
public bool DidLoadMenu { get; private set; }
/// <summary> /// <summary>
/// A hash used to find the associated beatmap if already imported. /// A hash used to find the associated beatmap if already imported.
/// </summary> /// </summary>
@ -32,35 +37,28 @@ public abstract class IntroScreen : StartupScreen
/// </summary> /// </summary>
protected abstract string BeatmapFile { get; } protected abstract string BeatmapFile { get; }
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
private const int exit_delay = 3000;
[Resolved]
private AudioManager audio { get; set; }
protected SampleChannel Welcome; protected SampleChannel Welcome;
private SampleChannel seeya;
protected Bindable<bool> MenuVoice; protected Bindable<bool> MenuVoice;
protected Bindable<bool> MenuMusic; protected Bindable<bool> MenuMusic;
protected WorkingBeatmap IntroBeatmap;
protected Track Track { get; private set; } protected Track Track { get; private set; }
protected WorkingBeatmap IntroBeatmap; private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
private const int exit_delay = 3000;
private SampleChannel seeya;
private LeasedBindable<WorkingBeatmap> beatmap; private LeasedBindable<WorkingBeatmap> beatmap;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack(); private MainMenu mainMenu;
protected void StartTrack() [Resolved]
{ private AudioManager audio { get; set; }
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
if (MenuMusic.Value)
Track.Restart();
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game) private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
@ -100,16 +98,7 @@ private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManag
Track = IntroBeatmap.Track; Track = IntroBeatmap.Track;
} }
/// <summary> public override bool OnExiting(IScreen next) => !DidLoadMenu;
/// Whether we have loaded the menu previously.
/// </summary>
public bool DidLoadMenu { get; private set; }
public override bool OnExiting(IScreen next)
{
//cancel exiting if we haven't loaded the menu yet.
return !DidLoadMenu;
}
public override void OnResuming(IScreen last) public override void OnResuming(IScreen last)
{ {
@ -131,6 +120,21 @@ public override void OnResuming(IScreen last)
base.OnResuming(last); base.OnResuming(last);
} }
public override void OnSuspending(IScreen next)
{
base.OnSuspending(next);
Track = null;
}
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
protected void StartTrack()
{
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
if (MenuMusic.Value)
Track.Restart();
}
protected override void LogoArriving(OsuLogo logo, bool resuming) protected override void LogoArriving(OsuLogo logo, bool resuming)
{ {
base.LogoArriving(logo, resuming); base.LogoArriving(logo, resuming);
@ -151,7 +155,7 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
else else
{ {
const int quick_appear = 350; const int quick_appear = 350;
int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0; var initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint); logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
@ -164,18 +168,7 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
} }
} }
public override void OnSuspending(IScreen next) protected void PrepareMenuLoad() => LoadComponentAsync(mainMenu = new MainMenu());
{
base.OnSuspending(next);
Track = null;
}
private MainMenu mainMenu;
protected void PrepareMenuLoad()
{
LoadComponentAsync(mainMenu = new MainMenu());
}
protected void LoadMenu() protected void LoadMenu()
{ {