using System; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace Unity.VisualScripting { public class EnumOptionTree : FuzzyOptionTree { public EnumOptionTree(Type enumType) : base(new GUIContent(enumType.HumanName())) { Ensure.That(nameof(enumType)).IsNotNull(enumType); enums = Enum.GetValues(enumType).Cast().ToList(); } private readonly List enums; public override IFuzzyOption Option(object item) { return new EnumOption((Enum)item); } public override IEnumerable Root() { return enums.Cast(); } public override IEnumerable Children(object item) { return Enumerable.Empty(); } public static EnumOptionTree For() { return new EnumOptionTree(typeof(T)); } } }