private Type GetMemberType() { Type memberInfoType = MemberInfoType; if (Accessor is CustomTypeFieldAccessor) { CustomTypeFieldAccessor accessor = (CustomTypeFieldAccessor)Accessor; memberInfoType = accessor.Type; } return(memberInfoType); }
public Type GetEnumType(object target) { CustomTypeFieldAccessor fieldAccessor = target as CustomTypeFieldAccessor; if (fieldAccessor != null) { return(fieldAccessor.Type); } else { return(MemberInfoType); } }
public Type GetElementType(object accessor, MemberInfo memberInfo) { CustomTypeFieldAccessor fieldAccessor = accessor as CustomTypeFieldAccessor; if (fieldAccessor != null) { m_propertyType = fieldAccessor.Type; m_elementType = fieldAccessor.Type.GetElementType(); if (m_elementType == null) { if (m_propertyType.IsGenericType) { m_elementType = fieldAccessor.Type.GetGenericArguments()[0]; } } } else { if (memberInfo is PropertyInfo) { m_propertyType = ((PropertyInfo)memberInfo).PropertyType; m_elementType = m_propertyType.GetElementType(); if (m_elementType == null) { if (m_propertyType.IsGenericType) { m_elementType = m_propertyType.GetGenericArguments()[0]; } } } else if (memberInfo is FieldInfo) { m_propertyType = ((FieldInfo)memberInfo).FieldType; m_elementType = m_propertyType.GetElementType(); if (m_elementType == null) { if (m_propertyType.IsGenericType) { m_elementType = m_propertyType.GetGenericArguments()[0]; } } } } return(m_elementType); }
public Type GetEnumType(object target) { CustomTypeFieldAccessor[] fieldAccessors = target as CustomTypeFieldAccessor[]; if (fieldAccessors != null && fieldAccessors.Length > 0 && fieldAccessors[0] != null) { return(fieldAccessors[0].Type); } else { CustomTypeFieldAccessor fieldAccessor = target as CustomTypeFieldAccessor; if (fieldAccessor != null) { return(fieldAccessor.Type); } else { return(MemberInfoType); } } }
private void CreateElementEditor(MemberInfo memberInfo, Type type) { if (!m_editorsMap.IsPropertyEditorEnabled(type)) { return; } GameObject editorPrefab = m_editorsMap.GetPropertyEditor(type); if (editorPrefab == null) { return; } PropertyEditor editor = Instantiate(editorPrefab).GetComponent <PropertyEditor>(); if (editor == null) { return; } CustomTypeFieldAccessor accessor = null; if (ChildDescriptors == null) { accessor = new CustomTypeFieldAccessor(this, memberInfo, memberInfo.Name); } else { PropertyDescriptor childPropertyDescriptor; if (ChildDescriptors.TryGetValue(memberInfo, out childPropertyDescriptor)) { accessor = new CustomTypeFieldAccessor( this, childPropertyDescriptor.MemberInfo, childPropertyDescriptor.Label); } } if (accessor != null) { editor.transform.SetParent(Panel, false); editor.Init(accessor, accessor, accessor.GetType().GetProperty("Value"), null, accessor.Name, OnValueChanging, OnValueChanged, null, false); } }