public static void Show <T>(EditorWindow root, System.Action <T> onSelect, System.Action <T> onEveryGUI = null, bool strongType = false, string directory = null) where T : Component
        {
            var editor = FlowChooserFilterWindow.GetInstance(root);

            editor.onSelect = (c) => {
                if (onSelect != null)
                {
                    onSelect(c as T);
                }
                editor.Close();
            };

            editor.onEveryGUI = (c) => {
                if (onEveryGUI != null)
                {
                    onEveryGUI(c as T);
                }
            };

            editor.Scan <T>(strongType, directory);
        }
Пример #2
0
        public static void Show <T>(EditorWindow root, System.Action <T> onSelect, System.Action <T> onEveryGUI = null, System.Func <T, bool> predicate = null, bool strongType = false, string directory = null, bool useCache = true, bool drawNoneOption = false, bool updateRedraw = false) where T : Component
        {
            var editor = FlowChooserFilterWindow.GetInstance(root, updateRedraw);

            editor.onSelect = (c) => {
                if (onSelect != null)
                {
                    onSelect(c as T);
                }
                editor.Close();
            };

            editor.onEveryGUI = (c) => {
                if (onEveryGUI != null)
                {
                    onEveryGUI(c as T);
                }
            };

            editor.Scan <T>(strongType, predicate, directory, useCache, drawNoneOption);
        }
        public static void ShowAssets <T>(EditorWindow root, System.Action <T> onSelect, System.Func <T, bool> onEveryGUI = null, System.Func <T, bool> predicate = null, string directory = null) where T : ScriptableObject
        {
            var editor = FlowChooserFilterWindow.GetInstance(root);

            editor.onSelectAsset = (c) => {
                if (onSelect != null)
                {
                    onSelect(c as T);
                }
                editor.Close();
            };

            editor.onEveryGUIAsset = (c) => {
                if (onEveryGUI != null)
                {
                    return(onEveryGUI(c as T));
                }

                return(false);
            };

            editor.ScanAssets <T>(directory, predicate);
        }