mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Update with framework-side bindable list changes
This commit is contained in:
@ -26,8 +26,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Playlist.ItemsAdded += _ => updateText();
|
||||
Playlist.ItemsRemoved += _ => updateText();
|
||||
Playlist.CollectionChanged += (_, __) => updateText();
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
}
|
||||
};
|
||||
|
||||
Playlist.ItemsAdded += _ => updateInfo();
|
||||
Playlist.ItemsRemoved += _ => updateInfo();
|
||||
Playlist.CollectionChanged += (_, __) => updateInfo();
|
||||
|
||||
updateInfo();
|
||||
}
|
||||
|
@ -48,8 +48,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
|
||||
Type.BindValueChanged(type => gameTypeContainer.Child = new DrawableGameType(type.NewValue) { Size = new Vector2(height) }, true);
|
||||
|
||||
Playlist.ItemsAdded += _ => updateBeatmap();
|
||||
Playlist.ItemsRemoved += _ => updateBeatmap();
|
||||
Playlist.CollectionChanged += (_, __) => updateBeatmap();
|
||||
|
||||
updateBeatmap();
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
{
|
||||
InternalChild = sprite = CreateBackgroundSprite();
|
||||
|
||||
Playlist.ItemsAdded += _ => updateBeatmap();
|
||||
Playlist.ItemsRemoved += _ => updateBeatmap();
|
||||
Playlist.CollectionChanged += (_, __) => updateBeatmap();
|
||||
|
||||
updateBeatmap();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -29,10 +30,15 @@ namespace osu.Game.Screens.Multi
|
||||
base.LoadComplete();
|
||||
|
||||
// Scheduled since items are removed and re-added upon rearrangement
|
||||
Items.ItemsRemoved += items => Schedule(() =>
|
||||
Items.CollectionChanged += (_, args) => Schedule(() =>
|
||||
{
|
||||
if (!Items.Contains(SelectedItem.Value))
|
||||
SelectedItem.Value = null;
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
if (args.OldItems.Contains(SelectedItem))
|
||||
SelectedItem.Value = null;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,7 @@ namespace osu.Game.Screens.Multi
|
||||
beatmap.BindValueChanged(_ => scheduleRefresh());
|
||||
ruleset.BindValueChanged(_ => scheduleRefresh());
|
||||
|
||||
requiredMods.ItemsAdded += _ => scheduleRefresh();
|
||||
requiredMods.ItemsRemoved += _ => scheduleRefresh();
|
||||
requiredMods.CollectionChanged += (_, __) => scheduleRefresh();
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
Reference in New Issue
Block a user