예제 #1
0
        static FieldFactory()
        {
            foreach (var type in UtilityRefelection.GetAllTypes())
            {
                UtilityAttribute.TryGetTypeAttribute(type, out FieldDrawerAttribute drawerAttribute);

                if (drawerAttribute == null)
                {
                    continue;
                }

                AddDrawer(drawerAttribute.fieldType, type);
            }

            // щ(ºДºщ) ...
            AddDrawer(typeof(bool), typeof(Toggle));
            AddDrawer(typeof(int), typeof(IntegerField));
            AddDrawer(typeof(long), typeof(LongField));
            AddDrawer(typeof(float), typeof(FloatField));
            AddDrawer(typeof(double), typeof(DoubleField));
            AddDrawer(typeof(string), typeof(TextField));
            AddDrawer(typeof(Bounds), typeof(BoundsField));
            AddDrawer(typeof(Color), typeof(ColorField));
            AddDrawer(typeof(Vector2), typeof(Vector2Field));
            AddDrawer(typeof(Vector2Int), typeof(Vector2IntField));
            AddDrawer(typeof(Vector3), typeof(Vector3Field));
            AddDrawer(typeof(Vector3Int), typeof(Vector3IntField));
            AddDrawer(typeof(Vector4), typeof(Vector4Field));
            AddDrawer(typeof(AnimationCurve), typeof(CurveField));
            AddDrawer(typeof(Enum), typeof(EnumField));
            AddDrawer(typeof(Gradient), typeof(GradientField));
            AddDrawer(typeof(UnityEngine.Object), typeof(ObjectField));
            AddDrawer(typeof(Rect), typeof(RectField));
        }
예제 #2
0
 static bool IsNodeAccessibleFromMenu(Type nodeType)
 {
     if (nodeType.IsAbstract)
     {
         return(false);
     }
     UtilityAttribute.TryGetTypeAttributes(nodeType, out var attributes);
     return(attributes.Any());
 }
예제 #3
0
 static void BuildNodeViewCache()
 {
     foreach (var nodeViewType in TypeCache.GetTypesDerivedFrom <BaseNodeView>())
     {
         if (nodeViewType.IsAbstract)
         {
             continue;
         }
         UtilityAttribute.TryGetTypeAttribute <NodeCustomEditor>(nodeViewType, out var nodeCustomEditor);
         if (nodeCustomEditor != null)
         {
             nodeViewPerType[nodeCustomEditor.nodeType] = nodeViewType;
         }
     }
 }