mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Only display SupportedWindowModes in settings
This commit is contained in:
@ -11,6 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -29,7 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
|
||||
private OsuGameBase game;
|
||||
private SettingsDropdown<Size> resolutionDropdown;
|
||||
private SettingsEnumDropdown<WindowMode> windowModeDropdown;
|
||||
private SettingsDropdown<WindowMode> windowModeDropdown;
|
||||
|
||||
private Bindable<float> scalingPositionX;
|
||||
private Bindable<float> scalingPositionY;
|
||||
@ -39,7 +40,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
private const int transition_duration = 400;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game)
|
||||
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game, GameHost host)
|
||||
{
|
||||
this.game = game;
|
||||
|
||||
@ -54,10 +55,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
windowModeDropdown = new SettingsEnumDropdown<WindowMode>
|
||||
windowModeDropdown = new SettingsDropdown<WindowMode>
|
||||
{
|
||||
LabelText = "Screen mode",
|
||||
Bindable = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
||||
ItemSource = host.Window.SupportedWindowModes,
|
||||
},
|
||||
resolutionSettingsContainer = new Container
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
@ -26,11 +27,25 @@ namespace osu.Game.Overlays.Settings
|
||||
}
|
||||
}
|
||||
|
||||
private IBindableList<T> itemSource;
|
||||
|
||||
public IBindableList<T> ItemSource
|
||||
{
|
||||
get => itemSource;
|
||||
set
|
||||
{
|
||||
itemSource = value;
|
||||
|
||||
if (Control != null)
|
||||
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 };
|
||||
protected virtual OsuDropdown<T> CreateDropdown() => new DropdownControl { Items = Items, ItemSource = ItemSource };
|
||||
|
||||
protected class DropdownControl : OsuDropdown<T>
|
||||
{
|
||||
|
Reference in New Issue
Block a user