1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 16:47:24 +08:00

Use the track's implemented looping algorithm to loop tracks in the song select screen

This commit is contained in:
MrTheMake 2017-05-21 15:57:41 +02:00
parent 043d1ed20a
commit 48f4879157
2 changed files with 10 additions and 8 deletions

View File

@ -65,6 +65,8 @@ namespace osu.Game.Screens.Select
protected override void OnResuming(Screen last) protected override void OnResuming(Screen last)
{ {
player = null; player = null;
Beatmap.Track.Looping = false;
base.OnResuming(last); base.OnResuming(last);
} }
@ -83,13 +85,19 @@ namespace osu.Game.Screens.Select
return true; return true;
} }
return base.OnExiting(next); if (base.OnExiting(next))
return true;
Beatmap.Track.Looping = false;
return false;
} }
protected override void OnSelected() protected override void OnSelected()
{ {
if (player != null) return; if (player != null) return;
Beatmap.Track.Looping = false;
LoadComponentAsync(player = new PlayerLoader(new Player LoadComponentAsync(player = new PlayerLoader(new Player
{ {
Beatmap = Beatmap, //eagerly set this so it's present before push. Beatmap = Beatmap, //eagerly set this so it's present before push.

View File

@ -348,6 +348,7 @@ namespace osu.Game.Screens.Select
trackManager.SetExclusive(track); trackManager.SetExclusive(track);
if (preview) if (preview)
track.Seek(Beatmap.Metadata.PreviewTime); track.Seek(Beatmap.Metadata.PreviewTime);
track.Looping = true;
track.Start(); track.Start();
} }
} }
@ -365,13 +366,6 @@ namespace osu.Game.Screens.Select
dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap)); dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap));
} }
protected override void Update()
{
base.Update();
ensurePlayingSelected();
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
if (args.Repeat) return false; if (args.Repeat) return false;