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

Allow preparing preview point without looping

This commit is contained in:
Dean Herbert 2022-08-17 13:20:24 +09:00
parent f30d68cd4e
commit 37799e3b31
5 changed files with 6 additions and 6 deletions

View File

@ -134,6 +134,6 @@ namespace osu.Game.Beatmaps
/// <summary> /// <summary>
/// Reads the correct track restart point from beatmap metadata and sets looping to enabled. /// Reads the correct track restart point from beatmap metadata and sets looping to enabled.
/// </summary> /// </summary>
void PrepareTrackForPreviewLooping(); void PrepareTrackForPreview(bool looping);
} }
} }

View File

@ -110,9 +110,9 @@ namespace osu.Game.Beatmaps
public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000); public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
public void PrepareTrackForPreviewLooping() public void PrepareTrackForPreview(bool looping)
{ {
Track.Looping = true; Track.Looping = looping;
Track.RestartPoint = Metadata.PreviewTime; Track.RestartPoint = Metadata.PreviewTime;
if (Track.RestartPoint == -1) if (Track.RestartPoint == -1)

View File

@ -192,7 +192,7 @@ namespace osu.Game.Screens.Menu
// presume the track is the current beatmap's track. not sure how correct this assumption is but it has worked until now. // presume the track is the current beatmap's track. not sure how correct this assumption is but it has worked until now.
if (!track.IsRunning) if (!track.IsRunning)
{ {
Beatmap.Value.PrepareTrackForPreviewLooping(); Beatmap.Value.PrepareTrackForPreview(false);
track.Restart(); track.Restart();
} }
} }

View File

@ -485,7 +485,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
if (track != null) if (track != null)
{ {
Beatmap.Value.PrepareTrackForPreviewLooping(); Beatmap.Value.PrepareTrackForPreview(true);
music?.EnsurePlayingSomething(); music?.EnsurePlayingSomething();
} }
} }

View File

@ -683,7 +683,7 @@ namespace osu.Game.Screens.Select
} }
private void ensureTrackLooping(IWorkingBeatmap beatmap, TrackChangeDirection changeDirection) private void ensureTrackLooping(IWorkingBeatmap beatmap, TrackChangeDirection changeDirection)
=> beatmap.PrepareTrackForPreviewLooping(); => beatmap.PrepareTrackForPreview(true);
public override bool OnBackButton() public override bool OnBackButton()
{ {