mirror of
https://github.com/ppy/osu
synced 2025-01-10 08:09:40 +00:00
Change collection management dialog to handle changes more correctly
This commit is contained in:
parent
5cc1cbe880
commit
695f156f5f
@ -43,8 +43,25 @@ namespace osu.Game.Collections
|
|||||||
|
|
||||||
private void collectionsChanged(IRealmCollection<BeatmapCollection> collections, ChangeSet? changes)
|
private void collectionsChanged(IRealmCollection<BeatmapCollection> collections, ChangeSet? changes)
|
||||||
{
|
{
|
||||||
Items.Clear();
|
if (changes == null)
|
||||||
Items.AddRange(collections.AsEnumerable().Select(c => c.ToLive(realm)));
|
{
|
||||||
|
Items.AddRange(collections.AsEnumerable().Select(c => c.ToLive(realm)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (int i in changes.DeletedIndices.OrderDescending())
|
||||||
|
Items.RemoveAt(i);
|
||||||
|
|
||||||
|
foreach (int i in changes.InsertedIndices)
|
||||||
|
Items.Insert(i, collections[i].ToLive(realm));
|
||||||
|
|
||||||
|
foreach (int i in changes.NewModifiedIndices)
|
||||||
|
{
|
||||||
|
var updatedItem = collections[i];
|
||||||
|
|
||||||
|
Items.RemoveAt(i);
|
||||||
|
Items.Insert(i, updatedItem.ToLive(realm));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override OsuRearrangeableListItem<Live<BeatmapCollection>> CreateOsuDrawable(Live<BeatmapCollection> item)
|
protected override OsuRearrangeableListItem<Live<BeatmapCollection>> CreateOsuDrawable(Live<BeatmapCollection> item)
|
||||||
|
Loading…
Reference in New Issue
Block a user