mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Remove unnecessary local item storage in SettingsDropdown
This commit is contained in:
@ -13,39 +13,23 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
protected new OsuDropdown<T> Control => (OsuDropdown<T>)base.Control;
|
||||
|
||||
private IEnumerable<T> items = Enumerable.Empty<T>();
|
||||
|
||||
public IEnumerable<T> Items
|
||||
{
|
||||
get => items;
|
||||
set
|
||||
{
|
||||
items = value;
|
||||
|
||||
if (Control != null)
|
||||
Control.Items = value;
|
||||
}
|
||||
get => Control.Items;
|
||||
set => Control.Items = value;
|
||||
}
|
||||
|
||||
private IBindableList<T> itemSource;
|
||||
|
||||
public IBindableList<T> ItemSource
|
||||
{
|
||||
get => itemSource;
|
||||
set
|
||||
{
|
||||
itemSource = value;
|
||||
|
||||
if (Control != null)
|
||||
Control.ItemSource = value;
|
||||
}
|
||||
get => Control.ItemSource;
|
||||
set => Control.ItemSource = value;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString()));
|
||||
|
||||
protected sealed override Drawable CreateControl() => CreateDropdown();
|
||||
|
||||
protected virtual OsuDropdown<T> CreateDropdown() => new DropdownControl { Items = Items, ItemSource = ItemSource };
|
||||
protected virtual OsuDropdown<T> CreateDropdown() => new DropdownControl();
|
||||
|
||||
protected class DropdownControl : OsuDropdown<T>
|
||||
{
|
||||
|
Reference in New Issue
Block a user