mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 04:12:57 +08:00
Stop detaching and exposing beatmaps from MusicController
This commit is contained in:
parent
d8270fe14f
commit
958cfde608
@ -30,8 +30,6 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
public IBindableList<BeatmapSetInfo> BeatmapSets => beatmapSets;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Point in time after which the current track will be restarted on triggering a "previous track" action.
|
/// Point in time after which the current track will be restarted on triggering a "previous track" action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -88,12 +86,12 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
beatmapSets.Clear();
|
beatmapSets.Clear();
|
||||||
foreach (var s in sender)
|
foreach (var s in sender)
|
||||||
beatmapSets.Add(s.Detach());
|
beatmapSets.Add(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (int i in changes.InsertedIndices)
|
foreach (int i in changes.InsertedIndices)
|
||||||
beatmapSets.Insert(i, sender[i].Detach());
|
beatmapSets.Insert(i, sender[i]);
|
||||||
|
|
||||||
foreach (int i in changes.DeletedIndices.OrderByDescending(i => i))
|
foreach (int i in changes.DeletedIndices.OrderByDescending(i => i))
|
||||||
beatmapSets.RemoveAt(i);
|
beatmapSets.RemoveAt(i);
|
||||||
@ -240,7 +238,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
queuedDirection = TrackChangeDirection.Prev;
|
queuedDirection = TrackChangeDirection.Prev;
|
||||||
|
|
||||||
var playable = BeatmapSets.TakeWhile(i => !i.Equals(current.BeatmapSetInfo)).LastOrDefault() ?? BeatmapSets.LastOrDefault();
|
var playable = beatmapSets.TakeWhile(i => !i.Equals(current.BeatmapSetInfo)).LastOrDefault() ?? beatmapSets.LastOrDefault();
|
||||||
|
|
||||||
if (playable != null)
|
if (playable != null)
|
||||||
{
|
{
|
||||||
@ -271,7 +269,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
queuedDirection = TrackChangeDirection.Next;
|
queuedDirection = TrackChangeDirection.Next;
|
||||||
|
|
||||||
var playableSet = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();
|
var playableSet = beatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? beatmapSets.FirstOrDefault();
|
||||||
var playableBeatmap = playableSet?.Beatmaps.FirstOrDefault();
|
var playableBeatmap = playableSet?.Beatmaps.FirstOrDefault();
|
||||||
|
|
||||||
if (playableBeatmap != null)
|
if (playableBeatmap != null)
|
||||||
@ -322,8 +320,8 @@ namespace osu.Game.Overlays
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// figure out the best direction based on order in playlist.
|
// figure out the best direction based on order in playlist.
|
||||||
int last = BeatmapSets.TakeWhile(b => !b.Equals(current.BeatmapSetInfo)).Count();
|
int last = beatmapSets.TakeWhile(b => !b.Equals(current.BeatmapSetInfo)).Count();
|
||||||
int next = newWorking == null ? -1 : BeatmapSets.TakeWhile(b => !b.Equals(newWorking.BeatmapSetInfo)).Count();
|
int next = newWorking == null ? -1 : beatmapSets.TakeWhile(b => !b.Equals(newWorking.BeatmapSetInfo)).Count();
|
||||||
|
|
||||||
direction = last > next ? TrackChangeDirection.Prev : TrackChangeDirection.Next;
|
direction = last > next ? TrackChangeDirection.Prev : TrackChangeDirection.Next;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
dragContainer.Add(playlist);
|
dragContainer.Add(playlist);
|
||||||
|
|
||||||
playlist.BeatmapSets.BindTo(musicController.BeatmapSets);
|
|
||||||
playlist.State.BindValueChanged(s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint), true);
|
playlist.State.BindValueChanged(s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint), true);
|
||||||
|
|
||||||
togglePlaylist();
|
togglePlaylist();
|
||||||
|
Loading…
Reference in New Issue
Block a user