mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 10:17:19 +08:00
Remove unnecessary local item storage in SettingsDropdown (#5142)
Remove unnecessary local item storage in SettingsDropdown
This commit is contained in:
commit
f2207aae4e
@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
|||||||
|
|
||||||
private class AudioDeviceSettingsDropdown : SettingsDropdown<string>
|
private class AudioDeviceSettingsDropdown : SettingsDropdown<string>
|
||||||
{
|
{
|
||||||
protected override OsuDropdown<string> CreateDropdown() => new AudioDeviceDropdownControl { Items = Items };
|
protected override OsuDropdown<string> CreateDropdown() => new AudioDeviceDropdownControl();
|
||||||
|
|
||||||
private class AudioDeviceDropdownControl : DropdownControl
|
private class AudioDeviceDropdownControl : DropdownControl
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
|
|
||||||
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
|
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
|
||||||
{
|
{
|
||||||
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl { Items = Items };
|
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl();
|
||||||
|
|
||||||
private class ResolutionDropdownControl : DropdownControl
|
private class ResolutionDropdownControl : DropdownControl
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
|
|
||||||
private class SkinSettingsDropdown : SettingsDropdown<SkinInfo>
|
private class SkinSettingsDropdown : SettingsDropdown<SkinInfo>
|
||||||
{
|
{
|
||||||
protected override OsuDropdown<SkinInfo> CreateDropdown() => new SkinDropdownControl { Items = Items };
|
protected override OsuDropdown<SkinInfo> CreateDropdown() => new SkinDropdownControl();
|
||||||
|
|
||||||
private class SkinDropdownControl : DropdownControl
|
private class SkinDropdownControl : DropdownControl
|
||||||
{
|
{
|
||||||
|
@ -13,39 +13,23 @@ namespace osu.Game.Overlays.Settings
|
|||||||
{
|
{
|
||||||
protected new OsuDropdown<T> Control => (OsuDropdown<T>)base.Control;
|
protected new OsuDropdown<T> Control => (OsuDropdown<T>)base.Control;
|
||||||
|
|
||||||
private IEnumerable<T> items = Enumerable.Empty<T>();
|
|
||||||
|
|
||||||
public IEnumerable<T> Items
|
public IEnumerable<T> Items
|
||||||
{
|
{
|
||||||
get => items;
|
get => Control.Items;
|
||||||
set
|
set => Control.Items = value;
|
||||||
{
|
|
||||||
items = value;
|
|
||||||
|
|
||||||
if (Control != null)
|
|
||||||
Control.Items = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBindableList<T> itemSource;
|
|
||||||
|
|
||||||
public IBindableList<T> ItemSource
|
public IBindableList<T> ItemSource
|
||||||
{
|
{
|
||||||
get => itemSource;
|
get => Control.ItemSource;
|
||||||
set
|
set => Control.ItemSource = value;
|
||||||
{
|
|
||||||
itemSource = value;
|
|
||||||
|
|
||||||
if (Control != null)
|
|
||||||
Control.ItemSource = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString()));
|
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString()));
|
||||||
|
|
||||||
protected sealed override Drawable CreateControl() => CreateDropdown();
|
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>
|
protected class DropdownControl : OsuDropdown<T>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user