1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Don't resume playback when user has paused and track hasn't changed

This commit is contained in:
Dean Herbert 2019-10-08 15:03:48 +09:00
parent e7fc5e556c
commit 4e026b163c

View File

@ -581,14 +581,24 @@ namespace osu.Game.Screens.Select
beatmap.Track.Looping = true;
}
private readonly WeakReference<Track> lastTrack = new WeakReference<Track>(null);
/// <summary>
/// Ensures some music is playing for the current track.
/// Will resume playback from a manual user pause if the track has changed.
/// </summary>
private void ensurePlayingSelected()
{
Track track = Beatmap.Value.Track;
bool isNewTrack = !lastTrack.TryGetTarget(out var last) || last != track;
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
if (!track.IsRunning)
if (!track.IsRunning && (music?.IsUserPaused != true || isNewTrack))
track.Restart();
lastTrack.SetTarget(track);
}
private void onBeatmapSetAdded(BeatmapSetInfo s) => Carousel.UpdateBeatmapSet(s);