Example #1
0
 public static PropertyDrawer CreatePropertyDrawer(NativeDrawerProperty drawerProperty, PropertyDrawerAttribute attr)
 {
     if (attrDrawerDic.TryGetValue(attr.GetType(), out Type drawerType))
     {
         return((PropertyDrawer)Activator.CreateInstance(drawerType, drawerProperty, attr));
     }
     return(null);
 }
Example #2
0
        public static NativeTypeDrawer CreateDefaultTypeDrawer(NativeDrawerProperty property)
        {
            Type type = GetDefaultType(property.ValueType);

            if (defaultTypeDrawerDic.TryGetValue(type, out Type drawerType))
            {
                return((NativeTypeDrawer)Activator.CreateInstance(drawerType, property));
            }
            return(null);
        }
Example #3
0
        private void InitField()
        {
            Type[] allTypes = NativeDrawerUtility.GetAllBaseTypes(drawerObject.GetType());
            if (allTypes != null)
            {
                foreach (var type in allTypes)
                {
                    TypeDrawerProperty typeDrawerProperty = new TypeDrawerProperty()
                    {
                        type = type,
                    };

                    FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
                    foreach (var field in fields)
                    {
                        NativeDrawerProperty drawerProperty = new NativeDrawerProperty(drawerObject, field);
                        typeDrawerProperty.drawerProperties.Add(drawerProperty);
                    }

                    typeDrawerProperties.Add(typeDrawerProperty);
                }
            }
        }
Example #4
0
 protected NativeTypeDrawer(NativeDrawerProperty property)
 {
     DrawerProperty = property;
 }