Beispiel #1
0
        /// <summary>
        /// 通过成员变量信息获取UIItem
        /// </summary>
        /// <param name="member"></param>
        /// <param name="parentElement"></param>
        /// <returns></returns>
        private InspectorElement CreateItemForMember(MemberInfo member, int depth)
        {
            if (Attribute.IsDefined(member, typeof(ElementIngoreAttribute)))
            {
                return(null);
            }

            CustomerElementAttribute attribute = member.GetCustomAttribute <CustomerElementAttribute>();

            if (attribute != null && attribute.type != null)
            {
                if (attribute is ArrayCustomrElementAttribute)
                {
                    return(Inspector.CreateCustomerArrayElemnet(attribute, depth));
                }
                else
                {
                    return(Inspector.CreateDrawerForType(attribute.type, depth, attribute.args));
                }
            }
            else
            {
                Type variableType = member is FieldInfo ? ((FieldInfo)member).FieldType : ((PropertyInfo)member).PropertyType;
                return(Inspector.CreateDrawerForMemberType(variableType, depth));
            }
        }
Beispiel #2
0
        /// <summary>
        /// 创建一个数组元素自定义的ArrayElement
        /// </summary>
        /// <param name="customerAttribute"></param>
        /// <param name="depth"></param>
        /// <returns></returns>
        public InspectorElement CreateCustomerArrayElemnet(CustomerElementAttribute customerAttribute, int depth)
        {
            InspectorElement element = Activator.CreateInstance(typeof(ArrayElement), customerAttribute) as InspectorElement;

            element.Inspector = this;
            element.Depth     = depth;
            return(element);
        }
Beispiel #3
0
 public ArrayElement(CustomerElementAttribute type) : this()
 {
     customerAttribute = type;
 }