Example #1
0
        private void OnDisable()
        {
            //Debug.Log(titleContent.text+" OnDisable");

            AssemblyReloadEvents.beforeAssemblyReload -= beforeAssemblyReload;

            QuickSwitch.OnWindowClosed(this);
        }
Example #2
0
        private void OnEnable()
        {
            //Debug.Log(titleContent.text + " OnEnable");

            AssemblyReloadEvents.beforeAssemblyReload += beforeAssemblyReload;

            AssemblyReloadEvents.afterAssemblyReload += afterAssemblyReload;

            QuickSwitch.OnWindowAdded(this);
        }
Example #3
0
        public EditorWindow RestoreWindow()
        {
            if (fullWindow == null)
            {
                if (windowTypeName != null)
                {
                    Type windowType = Type.GetType(windowTypeName);

                    ///Debug.Log("RestoreWindow '" + windowTypeName + "' type: " + windowType);

                    if (windowType != null)
                    {
                        fullWindow = EditorWindow.GetWindow(windowType); //false, fullWindow.titleContent.text

                        if (fullWindow.GetType().ToString().StartsWith("UnityEditor.InspectorWindow"))
                        {
                            if (QuickSwitch.CheckInspectorIsLocked(fullWindow))
                            {
                                //Debug.LogWarning("locked inspector - create a new one!");

                                fullWindow = ScriptableObject.CreateInstance(Type.GetType("UnityEditor.InspectorWindow, UnityEditor")) as EditorWindow;

                                fullWindow.Show();
                            }
                        }

                        fullWindow.position = new Rect(fullWindowPosition, fullWindowSize);

                        fullWindow.titleContent = titleContent;
                    }

                    if (fullWindow != null)
                    {
                        OnFullWindowCreated(fullWindow);

                        //Debug.LogWarning("RestoreWindow. Close()");

                        Close();
                    }
                }
            }

            return(fullWindow);
        }
Example #4
0
        public override void OnGUI()
        {
            base.OnGUI();

            GUILayout.BeginHorizontal();

            GUI.skin = skin;

            //GUILayout.Label("⋮⋮⋮", GUILayout.MinHeight(20));

            var e = Event.current;

            if (e.button == 0 && e.type == EventType.MouseDown)
            {
                //drag = false;

                click = true;
            }
            else if (e.type == EventType.MouseDrag)
            {
                //drag = true;

                click = false;
            }

            if (e.button == 0 && e.type == EventType.MouseUp && click)
            {
                vertical = !vertical;

                QuickSwitch.Resort();
            }

            if (GUILayout.Button(vertical ? "⋮" : "∙∙∙", GUILayout.MinHeight(20), GUILayout.MinWidth(20)))
            {
            }

            GUILayout.EndHorizontal();

            GUI.skin = null;
        }
Example #5
0
        void OnGUI()
        {
            GUILayout.BeginHorizontal();

            QuickSwitch.Auto_minimize = GUILayout.Toggle(QuickSwitch.Auto_minimize, "Auto minimize");

            QuickSwitch.Auto_inspector = GUILayout.Toggle(QuickSwitch.Auto_inspector, "Inspector auto-expand");

            GUILayout.EndHorizontal();

            GUILayout.Label("Minimized:");

            //foreach(var min in minimizedWindows)
            //{
            //    GUILayout.Label(min.titleContent.text);
            //}

            //GUILayout.Label("activeObject: " + QuickSwitch.activeObjectName);

            //GUILayout.Label("count: " + QuickSwitch.MinimizedWindowsCount);

            //GUILayout.Label("activeGameObject: " + Selection.activeGameObject);

            //GUILayout.Label("inspectorWindow: " + ((QuickSwitch.inspectorWindowMinimized != null) ? "Yes" : "No"));

            //GUILayout.Space(20);

            //if (EditorWindow.focusedWindow != null)
            //    GUILayout.Label("Focused: " + EditorWindow.focusedWindow.ToString());

            //GUILayout.Space(20);

            if (QuickSwitch.handlerWindow != null && GUILayout.Button("Reset Panel Position"))
            {
                QuickSwitch.ResetPanelPos();
            }
        }
Example #6
0
 void OnInitialized()
 {
     QuickSwitch.RegisterMinimizedWindow(this);
 }
Example #7
0
        public static void MinimizeWindow(EditorWindow window)
        {
            if (window == null)
            {
                Debug.LogWarning("MinimizeWindow null");

                return;
            }

            //if ((currentWindow as QuickSwitchWindow) != null)
            //{
            //return;
            //}

            if ((window as PopupWindow) != null)
            {
                Debug.LogWarning(window.titleContent.text + " PopupWindow can't be minimized");

                return;
            }

            if (excludedWindows.Contains(window))
            {
                Debug.LogWarning(window.titleContent.text + " is excluded from minimization");

                return;
            }

            if (IsDragAndDrop)
            {
                return;
            }

            string WindowTypeName = window.GetType().ToString();

            var assemblies = AppDomain.CurrentDomain.GetAssemblies();

            string assemblyName = "UnityEditor";

            foreach (var assembly in assemblies)
            {
                var textType = assembly.GetType(WindowTypeName);

                if (textType != null)
                {
                    assemblyName = assembly.FullName;

                    //Debug.Log("found assemblyName "+ assemblyName + " for "+ WindowTypeName);

                    break;
                }
            }

            WindowTypeName = WindowTypeName + ", " + assemblyName;

            if (Type.GetType(WindowTypeName) == null)
            {
                //Can't serialize type of this window as string
                Debug.LogWarning("Can't serialize type of this window as string " + WindowTypeName);

                return;
            }

            if (window.GetType().ToString().StartsWith("UnityEditor.InspectorWindow"))  //currentWindow.titleContent.text == "Inspector")
            {
                //Debug.LogWarning("Inspector type = "+ WindowTypeName);

                if ((QuickSwitch.Auto_inspector && Selection.activeGameObject != null) || QuickSwitch.CheckInspectorIsLocked(window))
                {
                    return;
                }
            }

            var minimized = createMinimizedWindow(window.titleContent, WindowTypeName, window.position);

            window.Close();

            //minimizedWindow.fullWindow = null;
            //currentWindow.minSize = Vector2.zero;
            //currentWindow.position = new Rect(new Vector2(Screen.currentResolution.width, Screen.currentResolution.height), Vector2.zero); //currentWindow.position.size
        }