private void OnEnable() { settings = (FinderSettings)target; _ignoreProperty = serializedObject.FindProperty("ingoreTypes"); _ignorelist = new ReorderableList(serializedObject, _ignoreProperty, true, true, false, true) { drawHeaderCallback = (rect) => { GUI.Label(rect, "IgnoreTypes"); }, onRemoveCallback = (ReorderableList list) => { settings.IngoreTypes.RemoveAt(list.index); }, drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { var type = settings.IngoreTypes[index]; EditorGUI.LabelField(rect, new GUIContent() { text = type.DisplayName, image = FinderAssetTypeProvider.GetTypeIcon(type.Type) }); } }; _findProperty = serializedObject.FindProperty("findTypes"); _findlist = new ReorderableList(serializedObject, _findProperty, true, true, false, true) { drawHeaderCallback = (rect) => { GUI.Label(rect, "FindTypes"); }, onRemoveCallback = (ReorderableList list) => { settings.FindTypes.RemoveAt(list.index); }, drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { var type = settings.FindTypes[index]; EditorGUI.LabelField(rect, new GUIContent() { text = type.DisplayName, image = FinderAssetTypeProvider.GetTypeIcon(type.Type) }); //*item.IsNameOnly? null : FinderAssetUtility.GetTypeIcon (item.Type)*/ } }; }
private void GridHiddenElement(FinderAssetType type) { gridItemContent.text = type.DisplayName; gridItemContent.image = FinderAssetTypeProvider.GetTypeIcon(type.Type) ?? EditorGUIUtility.IconContent("DefaultAsset Icon").image; GUILayout.Space(gridDrawer.margin); if (GUILayout.Button(gridItemContent, gridItemStyle, GUILayout.Width(gridDrawer.buttonSize), GUILayout.Height(gridDrawer.buttonSize))) { OnTypeSelected?.Invoke(type); this.Close(); } }
private void SetFindType(Type type) { searchType = type; if (type != null) { searchString = type.Name; foundedTypes = FinderAssetTypeProvider.GetAllTypesAssignableFrom(searchType).ToList(); } else { searchString = ""; foundedTypes = FinderAssetTypeProvider.GetAllTypes(); } foundedTypes = finderSettings.GetTypesByIngoreTypes(foundedTypes); foundedTypes = finderSettings.GetTypesWithBaseTypes(foundedTypes); foundedTypes = foundedTypes.Where(x => x != null).ToList(); foundedTypes.Sort((a, b) => { return(a.Type.BaseType.Name.CompareTo(b.Type.BaseType.Name)); }); gridDrawer.pagesCount = (int)(foundedTypes.Count() / gridDrawer.buttonsOnPage - 0.1f); gridDrawer.currentPage = 0; }