mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 13:07:25 +08:00
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:
commit
8d770404c0
@ -414,7 +414,6 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
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 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
if (this.IsCurrentScreen()) ensurePlayingSelected(preview);
|
||||
if (this.IsCurrentScreen())
|
||||
ensurePlayingSelected();
|
||||
UpdateBeatmap(Beatmap.Value);
|
||||
}
|
||||
}
|
||||
@ -577,17 +577,17 @@ namespace osu.Game.Screens.Select
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user