Ejemplo n.º 1
0
        public static MMReorderableList GetList(SerializedProperty property, MMReorderableAttributeAttribute attrib, int id)
        {
            if (property == null)
            {
                return(null);
            }

            MMReorderableList  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;

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

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

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

            return(list);
        }
Ejemplo n.º 2
0
 public static MMReorderableList GetList(SerializedProperty property, MMReorderableAttributeAttribute attrib)
 {
     return(GetList(property, attrib, GetListId(property)));
 }