public static QuickReorderableList GetList(SerializedProperty property, QuickReorderableAttribute attrib, int id, string arrayPropertyName) { if (property == null) { return(null); } QuickReorderableList list = null; SerializedProperty array = property.FindPropertyRelative(arrayPropertyName); 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; QuickReorderableList.ElementDisplayType displayType = attrib.singleLine ? QuickReorderableList.ElementDisplayType.SingleLine : QuickReorderableList.ElementDisplayType.Auto; list = new QuickReorderableList(array, attrib.add, attrib.remove, attrib.draggable, displayType, attrib.elementNameProperty, attrib.elementNameOverride, icon); list.paginate = attrib.paginate; list.pageSize = attrib.pageSize; list.sortable = attrib.sortable; //handle surrogate if any if (attrib.surrogateType != null) { SurrogateCallback callback = new SurrogateCallback(attrib.surrogateProperty); list.surrogate = new QuickReorderableList.Surrogate(attrib.surrogateType, callback.SetReference); } } else { list = new QuickReorderableList(array, true, true, true); } lists.Add(id, list); } else { list.List = array; } } return(list); }
public static QuickReorderableList GetList(SerializedProperty property, QuickReorderableAttribute attrib, string arrayPropertyName) { return(GetList(property, attrib, GetListId(property), arrayPropertyName)); }