mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:15:45 +08:00
Fix items in skin settings not always being removed corrrectly
This commit is contained in:
parent
43824c2a94
commit
5efa9c7652
@ -51,10 +51,10 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
},
|
||||
};
|
||||
|
||||
skins.ItemAdded += onItemsChanged;
|
||||
skins.ItemRemoved += onItemsChanged;
|
||||
skins.ItemAdded += itemAdded;
|
||||
skins.ItemRemoved += itemRemoved;
|
||||
|
||||
reloadSkins();
|
||||
skinDropdown.Items = skins.GetAllUsableSkins().Select(s => new KeyValuePair<string, int>(s.ToString(), s.ID));
|
||||
|
||||
var skinBindable = config.GetBindable<int>(OsuSetting.Skin);
|
||||
|
||||
@ -65,9 +65,8 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
skinDropdown.Bindable = skinBindable;
|
||||
}
|
||||
|
||||
private void reloadSkins() => skinDropdown.Items = skins.GetAllUsableSkins().Select(s => new KeyValuePair<string, int>(s.ToString(), s.ID));
|
||||
|
||||
private void onItemsChanged(SkinInfo _) => Schedule(reloadSkins);
|
||||
private void itemRemoved(SkinInfo s) => skinDropdown.Items = skinDropdown.Items.Where(i => i.Value != s.ID);
|
||||
private void itemAdded(SkinInfo s) => skinDropdown.Items = skinDropdown.Items.Append(new KeyValuePair<string, int>(s.ToString(), s.ID));
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
@ -75,8 +74,8 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
|
||||
if (skins != null)
|
||||
{
|
||||
skins.ItemAdded -= onItemsChanged;
|
||||
skins.ItemRemoved -= onItemsChanged;
|
||||
skins.ItemAdded -= itemAdded;
|
||||
skins.ItemRemoved -= itemRemoved;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user