1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Decrease the max height of dropdown menus in mod settings

This commit is contained in:
aitani9 2021-06-22 13:32:45 -07:00
parent 9cb9ef5c56
commit 59928a7d91

View File

@ -12,6 +12,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings;
namespace osu.Game.Configuration
@ -149,7 +150,7 @@ namespace osu.Game.Configuration
break;
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);
dropdownType.GetProperty(nameof(SettingsDropdown<object>.LabelText))?.SetValue(dropdown, attr.Label);
@ -183,5 +184,16 @@ namespace osu.Game.Configuration
=> obj.GetSettingsSourceProperties()
.OrderBy(attr => attr.Item1)
.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;
}
}
}
}