示例#1
0
        public static ReorderableList GetList(SerializedProperty property, ReorderableAttribute attrib, int id)
        {
            if (property == null)
            {
                return(null);
            }

            ReorderableList    list  = null;
            SerializedProperty array = property.FindPropertyRelative("array");

            if (array != null && array.isArray)
            {
                if (!lists.TryGetValue(id, out list))
                {
                    if (attrib != null)
                    {
                        Texture icon = !string.IsNullOrEmpty(attrib.elementIconPath) ? AssetDatabase.GetCachedIcon(attrib.elementIconPath) : null;

                        ReorderableList.ElementDisplayType displayType = attrib.singleLine ? ReorderableList.ElementDisplayType.SingleLine : ReorderableList.ElementDisplayType.Auto;

                        list = new ReorderableList(array, attrib.add, attrib.remove, attrib.draggable, displayType, attrib.elementNameProperty, attrib.elementNameOverride, icon);
                    }
                    else
                    {
                        list = new ReorderableList(array, true, true, true);
                    }

                    lists.Add(id, list);
                }
                else
                {
                    list.List = array;
                }
            }

            return(list);
        }
示例#2
0
 public static ReorderableList GetList(SerializedProperty property, ReorderableAttribute attrib)
 {
     return(GetList(property, attrib, GetListId(property)));
 }