mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 17:13:06 +08:00
Update playlist when adding or removing beatmap set
This commit is contained in:
parent
d344452e9b
commit
76edcb4a67
@ -73,6 +73,17 @@ namespace osu.Game.Overlays.Music
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
|
{
|
||||||
|
items.Add(new PlaylistItem(beatmapSet) { OnSelect = itemSelected });
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
|
{
|
||||||
|
PlaylistItem itemToRemove = items.Children.FirstOrDefault(item => item.BeatmapSetInfo == beatmapSet);
|
||||||
|
if (itemToRemove != null) items.Remove(itemToRemove);
|
||||||
|
}
|
||||||
|
|
||||||
private class ItemSearchContainer : FillFlowContainer<PlaylistItem>, IHasFilterableChildren
|
private class ItemSearchContainer : FillFlowContainer<PlaylistItem>, IHasFilterableChildren
|
||||||
{
|
{
|
||||||
public string[] FilterTerms => new string[] { };
|
public string[] FilterTerms => new string[] { };
|
||||||
|
@ -80,6 +80,9 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending).ToList();
|
list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending).ToList();
|
||||||
|
|
||||||
|
beatmaps.BeatmapSetAdded += onBeatmapSetAdded;
|
||||||
|
beatmaps.BeatmapSetRemoved += onBeatmapSetRemoved;
|
||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
|
||||||
filter.Search.OnCommit = (sender, newText) =>
|
filter.Search.OnCommit = (sender, newText) =>
|
||||||
@ -89,6 +92,17 @@ namespace osu.Game.Overlays.Music
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
if (beatmaps != null)
|
||||||
|
{
|
||||||
|
beatmaps.BeatmapSetAdded -= onBeatmapSetAdded;
|
||||||
|
beatmaps.BeatmapSetRemoved -= onBeatmapSetRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -124,6 +138,10 @@ namespace osu.Game.Overlays.Music
|
|||||||
playSpecified(set.Beatmaps[0]);
|
playSpecified(set.Beatmaps[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onBeatmapSetAdded(BeatmapSetInfo s) => list.AddBeatmapSet(s);
|
||||||
|
|
||||||
|
private void onBeatmapSetRemoved(BeatmapSetInfo s) => list.RemoveBeatmapSet(s);
|
||||||
|
|
||||||
public void PlayPrevious()
|
public void PlayPrevious()
|
||||||
{
|
{
|
||||||
var currentID = beatmapBacking.Value?.BeatmapSetInfo.ID ?? -1;
|
var currentID = beatmapBacking.Value?.BeatmapSetInfo.ID ?? -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user