Avoid beatmap load call in IntroScreen

This commit is contained in:
Dean Herbert
2020-08-21 15:50:14 +09:00
parent f7e4feee34
commit 0ae460fb8f
3 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,7 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Framework.Utils;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus namespace osu.Game.Tests.Visual.Menus
@ -15,7 +16,7 @@ namespace osu.Game.Tests.Visual.Menus
public TestSceneIntroWelcome() public TestSceneIntroWelcome()
{ {
AddUntilStep("wait for load", () => MusicController.TrackLoaded); AddUntilStep("wait for load", () => MusicController.TrackLoaded);
AddAssert("correct track", () => Precision.AlmostEquals(MusicController.CurrentTrack.Length, 48000, 1));
AddAssert("check if menu music loops", () => MusicController.CurrentTrack.Looping); AddAssert("check if menu music loops", () => MusicController.CurrentTrack.Looping);
} }
} }

View File

@ -66,6 +66,7 @@ namespace osu.Game.Screens.Menu
/// <summary> /// <summary>
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap. /// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
/// Only valid during or after <see cref="LogoArriving"/>.
/// </summary> /// </summary>
protected bool UsingThemedIntro { get; private set; } protected bool UsingThemedIntro { get; private set; }
@ -115,7 +116,6 @@ namespace osu.Game.Screens.Menu
if (setInfo != null) if (setInfo != null)
{ {
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
UsingThemedIntro = !initialBeatmap.LoadTrack().IsDummyDevice;
} }
return UsingThemedIntro; return UsingThemedIntro;
@ -169,6 +169,7 @@ namespace osu.Game.Screens.Menu
{ {
beatmap.Value = initialBeatmap; beatmap.Value = initialBeatmap;
Track = musicController.CurrentTrack; Track = musicController.CurrentTrack;
UsingThemedIntro = !initialBeatmap.LoadTrack().IsDummyDevice;
logo.MoveTo(new Vector2(0.5f)); logo.MoveTo(new Vector2(0.5f));
logo.ScaleTo(Vector2.One); logo.ScaleTo(Vector2.One);

View File

@ -44,7 +44,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
if (MenuVoice.Value && !UsingThemedIntro) if (MenuVoice.Value)
welcome = audio.Samples.Get(@"Intro/welcome"); welcome = audio.Samples.Get(@"Intro/welcome");
} }