mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 08:32:55 +08:00
Merge pull request #9391 from MiraiSubject/intro-loop
This commit is contained in:
commit
f7d74c138f
@ -19,10 +19,10 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
[Cached]
|
||||
private OsuLogo logo;
|
||||
|
||||
protected OsuScreenStack IntroStack;
|
||||
|
||||
protected IntroTestScene()
|
||||
{
|
||||
OsuScreenStack introStack = null;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -45,17 +45,17 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
logo.FinishTransforms();
|
||||
logo.IsTracking = false;
|
||||
|
||||
introStack?.Expire();
|
||||
IntroStack?.Expire();
|
||||
|
||||
Add(introStack = new OsuScreenStack
|
||||
Add(IntroStack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
introStack.Push(CreateScreen());
|
||||
IntroStack.Push(CreateScreen());
|
||||
});
|
||||
|
||||
AddUntilStep("wait for menu", () => introStack.CurrentScreen is MainMenu);
|
||||
AddUntilStep("wait for menu", () => IntroStack.CurrentScreen is MainMenu);
|
||||
}
|
||||
|
||||
protected abstract IScreen CreateScreen();
|
||||
|
@ -11,5 +11,18 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
public class TestSceneIntroWelcome : IntroTestScene
|
||||
{
|
||||
protected override IScreen CreateScreen() => new IntroWelcome();
|
||||
|
||||
public TestSceneIntroWelcome()
|
||||
{
|
||||
AddAssert("check if menu music loops", () =>
|
||||
{
|
||||
var menu = IntroStack?.CurrentScreen as MainMenu;
|
||||
|
||||
if (menu == null)
|
||||
return false;
|
||||
|
||||
return menu.Track.Looping;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
MenuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||
|
||||
seeya = audio.Samples.Get(SeeyaSampleName);
|
||||
|
||||
BeatmapSetInfo setInfo = null;
|
||||
|
@ -39,6 +39,8 @@ namespace osu.Game.Screens.Menu
|
||||
welcome = audio.Samples.Get(@"Intro/Welcome/welcome");
|
||||
|
||||
pianoReverb = audio.Samples.Get(@"Intro/Welcome/welcome_piano");
|
||||
|
||||
Track.Looping = true;
|
||||
}
|
||||
|
||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -63,6 +64,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => background;
|
||||
|
||||
internal Track Track { get; private set; }
|
||||
|
||||
private Bindable<float> holdDelay;
|
||||
private Bindable<bool> loginDisplayed;
|
||||
|
||||
@ -173,15 +176,15 @@ namespace osu.Game.Screens.Menu
|
||||
base.OnEntering(last);
|
||||
buttons.FadeInFromZero(500);
|
||||
|
||||
var track = Beatmap.Value.Track;
|
||||
Track = Beatmap.Value.Track;
|
||||
var metadata = Beatmap.Value.Metadata;
|
||||
|
||||
if (last is IntroScreen && track != null)
|
||||
if (last is IntroScreen && Track != null)
|
||||
{
|
||||
if (!track.IsRunning)
|
||||
if (!Track.IsRunning)
|
||||
{
|
||||
track.Seek(metadata.PreviewTime != -1 ? metadata.PreviewTime : 0.4f * track.Length);
|
||||
track.Start();
|
||||
Track.Seek(metadata.PreviewTime != -1 ? metadata.PreviewTime : 0.4f * Track.Length);
|
||||
Track.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user