コード例 #1
0
 private static T GetPropertyAttribute <T>(SerializedProperty property) where T : Attribute
 {
     T[] propertyAttributes = ReorderableArrayEditor.GetPropertyAttributes <T>(property);
     if (propertyAttributes != null && propertyAttributes.Length > 0)
     {
         return(propertyAttributes[0]);
     }
     return((T)((object)null));
 }
コード例 #2
0
 public static bool HasReorderableAttribute(SerializedProperty property)
 {
     PropertyAttribute[] propertyAttributes = ReorderableArrayEditor.GetPropertyAttributes <PropertyAttribute>(property);
     if (propertyAttributes != null)
     {
         PropertyAttribute[] array = propertyAttributes;
         for (int i = 0; i < array.Length; i++)
         {
             PropertyAttribute propertyAttribute = array[i];
             if (propertyAttribute.GetType().Name == "ReorderableAttribute")
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #3
0
        public void DrawReorderableArray(SerializedProperty property)
        {
            HeaderAttribute propertyAttribute = ReorderableArrayEditor.GetPropertyAttribute <HeaderAttribute>(property);

            if (propertyAttribute != null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(propertyAttribute.header, EditorStyles.boldLabel, new GUILayoutOption[0]);
            }
            ReorderableArrayEditor.ReorderableListWrapper reorderableListWrapper = this.GetReorderableListWrapper(property);
            if (reorderableListWrapper.isExpanded)
            {
                reorderableListWrapper.list.DoLayoutList();
            }
            else
            {
                property.isExpanded = (EditorGUILayout.Foldout(property.isExpanded, new GUIContent(string.Format("{0} [{1}]", property.displayName, property.arraySize), property.tooltip)));
            }
        }
コード例 #4
0
 public void DrawProperty(SerializedProperty property)
 {
     if (property.isArray && property.propertyType != SerializedPropertyType.String && ReorderableArrayEditor.HasReorderableAttribute(property))
     {
         this.DrawReorderableArray(property);
     }
     else
     {
         EditorGUILayout.PropertyField(property, property.isExpanded, new GUILayoutOption[0]);
     }
 }