1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:42:56 +08:00

Fix preview tracks not stopping playback when suspending/exiting daily challenge screen

Closes https://github.com/ppy/osu/issues/29083.
This commit is contained in:
Bartłomiej Dach 2024-07-26 10:53:12 +02:00
parent e489ae8f72
commit f9cfc7d96c
No known key found for this signature in database

View File

@ -17,6 +17,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics.Containers;
@ -40,7 +41,8 @@ using osuTK;
namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
public partial class DailyChallenge : OsuScreen
[Cached(typeof(IPreviewTrackOwner))]
public partial class DailyChallenge : OsuScreen, IPreviewTrackOwner
{
private readonly Room room;
private readonly PlaylistItem playlistItem;
@ -91,6 +93,9 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
[Resolved]
protected IAPIProvider API { get; private set; } = null!;
[Resolved]
private PreviewTrackManager previewTrackManager { get; set; } = null!;
public override bool DisallowExternalBeatmapRulesetChanges => true;
public DailyChallenge(Room room)
@ -441,6 +446,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
userModsSelectOverlay.Hide();
cancelTrackLooping();
previewTrackManager.StopAnyPlaying(this);
}
public override bool OnExiting(ScreenExitEvent e)
@ -448,6 +454,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
waves.Hide();
userModsSelectOverlay.Hide();
cancelTrackLooping();
previewTrackManager.StopAnyPlaying(this);
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
roomManager.PartRoom();