1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

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 osu.Framework.Screens;
using osu.Framework.Utils;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus
@ -15,7 +16,7 @@ namespace osu.Game.Tests.Visual.Menus
public TestSceneIntroWelcome()
{
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);
}
}

View File

@ -66,6 +66,7 @@ namespace osu.Game.Screens.Menu
/// <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; }
@ -115,7 +116,6 @@ namespace osu.Game.Screens.Menu
if (setInfo != null)
{
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
UsingThemedIntro = !initialBeatmap.LoadTrack().IsDummyDevice;
}
return UsingThemedIntro;
@ -169,6 +169,7 @@ namespace osu.Game.Screens.Menu
{
beatmap.Value = initialBeatmap;
Track = musicController.CurrentTrack;
UsingThemedIntro = !initialBeatmap.LoadTrack().IsDummyDevice;
logo.MoveTo(new Vector2(0.5f));
logo.ScaleTo(Vector2.One);

View File

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