private void OnGUI()
        {
            LoadResources();

            searchText = SearchUtils.BeginSearchbar(this, searchText);
            if (SearchUtils.Button(new GUIContent("Remove All"), GUILayout.MaxWidth(CLEAR_BUTTON_WIDTH)))
            {
                list.Clear();

                Repaint();
            }
            SearchUtils.EndSearchbar();

            using (var scrollView = new GUILayout.ScrollViewScope(scrollPos, false, false))
            {
                scrollPos = scrollView.scrollPosition;

                for (int i = list.References.Count - 1; i >= 0; i--)
                {
                    var reference = list.References[i];

                    if (SearchUtils.IsSearched(reference, searchText))
                    {
                        if (DrawElement(reference))
                        {
                            list.RemoveReference(reference);
                        }
                    }
                }

                list.References.RemoveAll(reference => reference == null);
            }

            DetectDragNDrop();
        }
Beispiel #2
0
        private void OnGUI()
        {
            LoadResources();

            if (pathList.Count <= 0)
            {
                if (GUILayout.Button(new GUIContent("Create a Favorites List"), GUILayout.MinHeight(50f)))
                {
                    EditorApplication.ExecuteMenuItem("Assets/Create/" + Constants.CREATE_MENU_OPTION);
                }
                return;
            }

            GUILayout.BeginHorizontal(SKIN_TOOLBAR);
            index = EditorGUILayout.Popup(index, listNames.ToArray(), EditorStyles.toolbarDropDown);

            selectedName = listNames[index];
            list         = ListData.LoadList(pathList[index]);

            if (GUILayout.Button(EditorGUIUtility.FindTexture(BUTTON_ICON_SELECT), SKIN_BUTTON, GUILayout.MaxWidth(ICON_BUTTON_WIDTH)))
            {
                EditorGUIUtility.PingObject(list);
            }
            if (GUILayout.Button(EditorGUIUtility.FindTexture(BUTTON_ICON_ADD), SKIN_BUTTON, GUILayout.MaxWidth(ICON_BUTTON_WIDTH)))
            {
                EditorApplication.ExecuteMenuItem("Assets/Create/" + Constants.CREATE_MENU_OPTION);
            }
            GUILayout.EndHorizontal();

            searchText = SearchUtils.BeginSearchbar(this, searchText);
            if (SearchUtils.Button(new GUIContent("Remove All"), GUILayout.MaxWidth(CLEAR_BUTTON_WIDTH)))
            {
                list.Clear();

                Repaint();
            }
            SearchUtils.EndSearchbar();


            using (var scrollView = new GUILayout.ScrollViewScope(scrollPos, false, false))
            {
                scrollPos = scrollView.scrollPosition;

                for (int i = list.References.Count - 1; i >= 0; i--)
                {
                    var reference = list.References[i];

                    if (SearchUtils.IsSearched(reference, searchText))
                    {
                        if (DrawElement(reference))
                        {
                            list.RemoveReference(reference);
                        }
                    }
                }

                list.References.RemoveAll(reference => reference == null);
            }

            DetectDragNDrop();
        }