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); }
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); }
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); } } }
protected NativeTypeDrawer(NativeDrawerProperty property) { DrawerProperty = property; }