Merge pull request #4156 from Aergwyn/correct-preview-loop

Correctly loop from preview point in song select

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-03-29 12:16:48 +09:00 committed by GitHub
commit 8d770404c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -414,7 +414,6 @@ void run()
{
Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\"");
preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
if (beatmap != null)
@ -426,7 +425,8 @@ void run()
}
}
if (this.IsCurrentScreen()) ensurePlayingSelected(preview);
if (this.IsCurrentScreen())
ensurePlayingSelected();
UpdateBeatmap(Beatmap.Value);
}
}
@ -577,17 +577,17 @@ protected virtual void UpdateBeatmap(WorkingBeatmap beatmap)
beatmap.Track.Looping = true;
}
private void ensurePlayingSelected(bool preview = false)
private void ensurePlayingSelected(bool restart = false)
{
Track track = Beatmap.Value.Track;
if (!track.IsRunning)
if (!track.IsRunning || restart)
{
// Ensure the track is added to the TrackManager, since it is removed after the player finishes the map.
// Using AddItemToList rather than AddItem so that it doesn't attempt to register adjustment dependencies more than once.
Game.Audio.Track.AddItemToList(track);
if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime);
track.Start();
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
track.Restart();
}
}