1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 17:52:54 +08:00

Display all usable beatmaps in playlist, including protected

This commit is contained in:
Dean Herbert 2020-07-10 16:33:31 +09:00
parent 632f333ce2
commit 49b88971d1

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
@ -71,7 +72,7 @@ namespace osu.Game.Overlays
managerRemoved = beatmaps.ItemRemoved.GetBoundCopy(); managerRemoved = beatmaps.ItemRemoved.GetBoundCopy();
managerRemoved.BindValueChanged(beatmapRemoved); managerRemoved.BindValueChanged(beatmapRemoved);
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal).OrderBy(_ => RNG.Next())); beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal, true).OrderBy(_ => RNG.Next()));
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -135,6 +136,7 @@ namespace osu.Game.Overlays
/// <summary> /// <summary>
/// Start playing the current track (if not already playing). /// Start playing the current track (if not already playing).
/// Will select the next valid track if the current track is null or <see cref="TrackVirtual"/>.
/// </summary> /// </summary>
/// <returns>Whether the operation was successful.</returns> /// <returns>Whether the operation was successful.</returns>
public bool Play(bool restart = false) public bool Play(bool restart = false)
@ -143,12 +145,12 @@ namespace osu.Game.Overlays
IsUserPaused = false; IsUserPaused = false;
if (track == null) if (track == null || track is TrackVirtual)
{ {
if (beatmap.Disabled) if (beatmap.Disabled)
return false; return false;
next(true); next();
return true; return true;
} }
@ -228,9 +230,8 @@ namespace osu.Game.Overlays
/// </summary> /// </summary>
public void NextTrack() => Schedule(() => next()); public void NextTrack() => Schedule(() => next());
private bool next(bool instant = false) private bool next()
{ {
if (!instant)
queuedDirection = TrackChangeDirection.Next; queuedDirection = TrackChangeDirection.Next;
var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault(); var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();