mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Make prev and next work again.
This commit is contained in:
@ -34,7 +34,6 @@ namespace osu.Desktop.Tests
|
|||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
ourClock.ProcessFrame();
|
ourClock.ProcessFrame();
|
||||||
mc?.CurrentTrack?.Stop();
|
|
||||||
mc = new MusicController
|
mc = new MusicController
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -186,6 +186,10 @@ namespace osu.Game.Overlays
|
|||||||
playButton.Icon = FontAwesome.pause;
|
playButton.Icon = FontAwesome.pause;
|
||||||
updateCurrent(beatmapSource, null);
|
updateCurrent(beatmapSource, null);
|
||||||
}
|
}
|
||||||
|
else if (playList.Count > 0)
|
||||||
|
{
|
||||||
|
play(playList[0].Beatmaps[0], null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -196,22 +200,36 @@ namespace osu.Game.Overlays
|
|||||||
if (CurrentTrack.HasCompleted) next();
|
if (CurrentTrack.HasCompleted) next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int findInPlaylist(Beatmap beatmap)
|
||||||
|
{
|
||||||
|
if (beatmap == null) return -1;
|
||||||
|
for (int i = 0; i < playList.Count; i++)
|
||||||
|
if (beatmap.BeatmapInfo.BeatmapSetID == playList[i].BeatmapSetID)
|
||||||
|
return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
private void prev()
|
private void prev()
|
||||||
{
|
{
|
||||||
int i = playList.IndexOf(currentPlay);
|
int i = findInPlaylist(beatmapSource.Value?.Beatmap);
|
||||||
if (i == -1) return;
|
if (i == -1) return;
|
||||||
i = (i - 1 + playList.Count) % playList.Count;
|
i = (i - 1 + playList.Count) % playList.Count;
|
||||||
currentPlay = playList[i];
|
play(playList[i].Beatmaps[0], false);
|
||||||
play(currentPlay, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void next()
|
private void next()
|
||||||
{
|
{
|
||||||
int i = playList.IndexOf(currentPlay);
|
int i = findInPlaylist(beatmapSource.Value?.Beatmap);
|
||||||
if (i == -1) return;
|
if (i == -1) return;
|
||||||
i = (i + 1) % playList.Count;
|
i = (i + 1) % playList.Count;
|
||||||
currentPlay = playList[i];
|
play(playList[i].Beatmaps[0], true);
|
||||||
play(currentPlay, true);
|
}
|
||||||
|
|
||||||
|
private void play(BeatmapInfo info, bool? isNext)
|
||||||
|
{
|
||||||
|
WorkingBeatmap working = database.GetWorkingBeatmap(info, beatmapSource.Value);
|
||||||
|
beatmapSource.Value = working;
|
||||||
|
updateCurrent(working, isNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCurrent(WorkingBeatmap beatmap, bool? isNext)
|
private void updateCurrent(WorkingBeatmap beatmap, bool? isNext)
|
||||||
|
Reference in New Issue
Block a user