mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Enum constraint for enum dropdown.
This commit is contained in:
@ -6,12 +6,10 @@ using System;
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class OsuEnumDropdown<T> : OsuDropdown<T>
|
||||
where T : struct, Enum
|
||||
{
|
||||
public OsuEnumDropdown()
|
||||
{
|
||||
if (!typeof(T).IsEnum)
|
||||
throw new InvalidOperationException("OsuEnumDropdown only supports enums as the generic type argument");
|
||||
|
||||
Items = (T[])Enum.GetValues(typeof(T));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user