1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-24 06:19:55 +08:00

Merge pull request #14708 from peppy/fix-triangle-intro-disposed-track

Fix triangles intro attempting to restart track after it is disposed
This commit is contained in:
Dan Balasescu
2021-09-10 20:50:54 +09:00
committed by GitHub
Unverified
2 changed files with 24 additions and 1 deletions
@@ -15,6 +15,7 @@ using osu.Game.Overlays.Mods;
using osu.Game.Overlays.Toolbar;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Menu;
using osu.Game.Screens.OnlinePlay.Components;
using osu.Game.Screens.OnlinePlay.Lounge;
using osu.Game.Screens.Play;
@@ -388,6 +389,19 @@ namespace osu.Game.Tests.Visual.Navigation
AddAssert("now playing is hidden", () => nowPlayingOverlay.State.Value == Visibility.Hidden);
}
[Test]
public void TestExitGameFromSongSelect()
{
PushAndConfirm(() => new TestPlaySongSelect());
exitViaEscapeAndConfirm();
pushEscape(); // returns to osu! logo
AddStep("Hold escape", () => InputManager.PressKey(Key.Escape));
AddUntilStep("Wait for intro", () => Game.ScreenStack.CurrentScreen is IntroTriangles);
AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null);
}
private void pushEscape() =>
AddStep("Press escape", () => InputManager.Key(Key.Escape));
+10 -1
View File
@@ -42,6 +42,7 @@ namespace osu.Game.Screens.Menu
private Sample welcome;
private DecoupleableInterpolatingFramedClock decoupledClock;
private TrianglesIntroSequence intro;
[BackgroundDependencyLoader]
private void load()
@@ -66,7 +67,7 @@ namespace osu.Game.Screens.Menu
if (UsingThemedIntro)
decoupledClock.ChangeSource(Track);
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
LoadComponentAsync(intro = new TrianglesIntroSequence(logo, background)
{
RelativeSizeAxes = Axes.Both,
Clock = decoupledClock,
@@ -82,6 +83,14 @@ namespace osu.Game.Screens.Menu
}
}
public override void OnSuspending(IScreen next)
{
base.OnSuspending(next);
// important as there is a clock attached to a track which will likely be disposed before returning to this screen.
intro.Expire();
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);