Beispiel #1
0
        // ------------------------------------------------------------------------------------------------------------------

        private void OnGUI()
        {
            if (treeView == null)
            {
                UpdateTreeview();
            }

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                treeView.searchString = searchField.OnToolbarGUI(treeView.searchString, GUILayout.ExpandWidth(true));
                GUILayout.Space(5);
                if (GUILayout.Button(GC_Add, EditorStyles.toolbarButton, GUILayout.Width(25)))
                {
                    TextInputWindow.ShowWindow("Favourites", "Enter category name", "", AddCategory, null);
                }
                GUI.enabled = treeView.Model.Data.Count > 0;
                if (GUILayout.Button(GC_Remove, EditorStyles.toolbarButton, GUILayout.Width(25)))
                {
                    RemoveSelected();
                }
                GUI.enabled = true;
            }
            EditorGUILayout.EndHorizontal();

            treeView.OnGUI();
        }
Beispiel #2
0
        // ------------------------------------------------------------------------------------------------------------------

        private void OnGUI()
        {
            if (treeView == null)
            {
                UpdateTreeview();
            }

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                treeView.searchString = searchField.OnToolbarGUI(treeView.searchString, GUILayout.ExpandWidth(true));
                GUILayout.Space(5);
                if (GUILayout.Button(GC_Add, EditorStyles.toolbarButton, GUILayout.Width(80)))
                {
                    TextInputWindow.ShowWindow("Favorite Assets", "Enter category name", "", AddCategory, null);
                }
                GUI.enabled = treeView.Model.Data.Count > 0;
                if (GUILayout.Button(GC_Remove, EditorStyles.toolbarButton, GUILayout.Width(95)) && EditorUtility.DisplayDialog("Are you sure?", "Are you sure you want to delete the references to the selected items?\n\nIf a category was selected, the items within it will be deleted as well.", "Yes, I'm Sure.", "Changed My Mind."))
                {
                    RemoveSelected();
                }
                GUI.enabled = true;
            }
            EditorGUILayout.EndHorizontal();

            treeView.OnGUI();
        }
Beispiel #3
0
        public static void ShowWindow(string title, string label, string currText, System.Action <TextInputWindow> callback, object[] args, float width = 250)
        {
            TextInputWindow win = GetWindow <TextInputWindow>(true, title, true);

            win.label    = label;
            win.Text     = currText;
            win.callback = callback;
            win.Args     = args;
            win.minSize  = win.maxSize = new Vector2(width, 100);
            win.ShowUtility();
        }
Beispiel #4
0
        // ------------------------------------------------------------------------------------------------------------------

        private void AddCategory(TextInputWindow wiz)
        {
            string s = wiz.Text;

            wiz.Close();
            if (string.IsNullOrEmpty(s))
            {
                return;
            }

            asset.AddCategory(s);
            EditorUtility.SetDirty(asset);

            UpdateTreeview();
            Repaint();
        }