mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 19:35:15 +08:00
Decrease the max height of dropdown menus in mod settings
This commit is contained in:
parent
9cb9ef5c56
commit
59928a7d91
@ -12,6 +12,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
|
|
||||||
namespace osu.Game.Configuration
|
namespace osu.Game.Configuration
|
||||||
@ -149,7 +150,7 @@ namespace osu.Game.Configuration
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IBindable bindable:
|
case IBindable bindable:
|
||||||
var dropdownType = typeof(SettingsEnumDropdown<>).MakeGenericType(bindable.GetType().GetGenericArguments()[0]);
|
var dropdownType = typeof(ModSettingsEnumDropdown<>).MakeGenericType(bindable.GetType().GetGenericArguments()[0]);
|
||||||
var dropdown = (Drawable)Activator.CreateInstance(dropdownType);
|
var dropdown = (Drawable)Activator.CreateInstance(dropdownType);
|
||||||
|
|
||||||
dropdownType.GetProperty(nameof(SettingsDropdown<object>.LabelText))?.SetValue(dropdown, attr.Label);
|
dropdownType.GetProperty(nameof(SettingsDropdown<object>.LabelText))?.SetValue(dropdown, attr.Label);
|
||||||
@ -183,5 +184,16 @@ namespace osu.Game.Configuration
|
|||||||
=> obj.GetSettingsSourceProperties()
|
=> obj.GetSettingsSourceProperties()
|
||||||
.OrderBy(attr => attr.Item1)
|
.OrderBy(attr => attr.Item1)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
private class ModSettingsEnumDropdown<T> : SettingsEnumDropdown<T>
|
||||||
|
where T : struct, Enum
|
||||||
|
{
|
||||||
|
protected override OsuDropdown<T> CreateDropdown() => new ModDropdownControl();
|
||||||
|
|
||||||
|
private class ModDropdownControl : DropdownControl
|
||||||
|
{
|
||||||
|
protected override int MenuMaxHeight => 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user