/// <summary> /// GetLabel /// </summary> /// <param name="_propertyKey">属性Key</param> /// <param name="_position">位置</param> /// <param name="_property">属性</param> /// <param name="_label">标签</param> /// <param name="_fieldInfo">字段信息</param> public override GUIContent Execute(int _propertyKey, Rect _position, SerializedProperty _property, GUIContent _label, FieldInfo _fieldInfo) { if (!mStaticClassConstFieldMapForEnumAttributeMaping.ContainsKey(_propertyKey)) { StaticClassConstFieldMapForEnumAttribute attr = _fieldInfo.GetFirstAttributeAbsolute <StaticClassConstFieldMapForEnumAttribute>(); mStaticClassConstFieldMapForEnumAttributeMaping.Add(_propertyKey, attr); } return(_label); }
/// <summary> /// 解析静态类常量映射枚举 /// </summary> /// <param name="_fieldInfo">字段属性</param> /// <param name="_staticTypeKey">静态类Key值</param> /// <returns>true:成功,false:失败</returns> bool OnResolveStaticClassConstFieldMapForEnum(FieldInfo _fieldInfo, out int _staticTypeKey) { StaticClassConstFieldMapForEnumAttribute att = _fieldInfo.GetFirstAttribute <StaticClassConstFieldMapForEnumAttribute>(); bool result = att != null; _staticTypeKey = att.staticType.GetHashCode(); if (!mPopupStaticClassConstFieldMapForEnumValueMaping.ContainsKey(_staticTypeKey)) { Dictionary <object, string> data = att.staticType.ValueToAttributeSpecifyValueForConstField <object, AliasTooltipAttribute, string>((a) => { return(a.alias); }); mPopupStaticClassConstFieldMapForEnumAliasMaping.Add(_staticTypeKey, new GUIContent[data.Count]); mPopupStaticClassConstFieldMapForEnumValueMaping.Add(_staticTypeKey, new object[data.Count]); mPopupStaticClassConstFieldMapForMaskEnumAliasMaping.Add(_staticTypeKey, new string[data.Count]); int index = 0; foreach (KeyValuePair <object, string> key in data) { mPopupStaticClassConstFieldMapForEnumAliasMaping[_staticTypeKey][index] = new GUIContent(key.Value); mPopupStaticClassConstFieldMapForEnumValueMaping[_staticTypeKey][index] = key.Key; mPopupStaticClassConstFieldMapForMaskEnumAliasMaping[_staticTypeKey][index] = key.Value; index++; } mPopupStaticClassConstFieldMapForEnumFlagsMaping.Add(_staticTypeKey, att.staticType.GetFirstAttribute <StaticClassConstFieldFlagsAttribute>() != null); } return(result); }