private void DrawRefreshStatus()
        {
            bool compiling        = EditorApplication.isCompiling;
            bool assembliesLocked = !EditorApplication.CanReloadAssemblies();

            if (compiling || showProgress)
            {
                if (assembliesLocked)
                {
                    GUILayout.Button(Styles.assemblyLock, Styles.statusIcon);
                }
                else
                {
                    int frame = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10, 11.99f);
                    GUILayout.Button(Styles.statusWheel[frame], Styles.statusIcon);
                }
            }
            else
            {
                if (GUILayout.Button(Styles.progressIcon, Styles.statusIcon))
                {
                    Progress.ShowDetails();
                }

                var buttonRect = GUILayoutUtility.GetLastRect();
                EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
            }
        }
示例#2
0
        private void DrawRefreshStatus()
        {
            bool compiling        = EditorApplication.isCompiling;
            bool assembliesLocked = !EditorApplication.CanReloadAssemblies();

            if (compiling || showProgress)
            {
                if (assembliesLocked)
                {
                    GUILayout.Button(Styles.assemblyLock, Styles.statusIcon);
                }
                else
                {
                    int frame = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10, 11.99f);
                    GUILayout.Button(Styles.statusWheel[frame], Styles.statusIcon);
                }
            }
            else
            {
                if (GUILayout.Button(Styles.progressIcon, Styles.statusIcon))
                {
                    Progress.ShowDetails();
                }

                var buttonRect = GUILayoutUtility.GetLastRect();
                EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
            }

            GUILayout.Space(Styles.spacing);

            if (Unsupported.IsBleedingEdgeBuild())
            {
                var backup = GUI.color;
                GUI.color = Color.yellow;
                GUILayout.Label("THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD");
                GUI.color = backup;
            }
            else if (Unsupported.IsDeveloperMode())
            {
                GUILayout.Label(m_MiniMemoryOverview, Styles.statusLabel);
                EditorGUIUtility.CleanCache(m_MiniMemoryOverview);
            }
        }
示例#3
0
        protected override void OldOnGUI()
        {
            const int spacing                  = 4;
            const int statusWheelWidth         = 24;
            const int progressBarWidth         = 185;
            float     lightingBakeModeBarWidth = EditorStyles.progressBarText.CalcSize(EditorGUIUtility.TempContent(m_BakeModeString)).x;
            const int barHeight                = 19;

            ConsoleWindow.LoadIcons();

            if (background == null)
            {
                background = "AppToolbar";
            }

            GUI.color = EditorApplication.isPlayingOrWillChangePlaymode ? HostView.kPlayModeDarken : Color.white;

            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            bool compiling        = EditorApplication.isCompiling;
            bool assembliesLocked = !EditorApplication.CanReloadAssemblies();

            GUILayout.BeginHorizontal();
            GUILayout.Space(2);

            float statusBarItemsWidth = statusWheelWidth + (AsyncProgressBar.isShowing ? (progressBarWidth + spacing) : 0) + (showBakeMode ? (lightingBakeModeBarWidth + spacing) : 0);

            if (Event.current.type == EventType.MouseDown)
            {
                Rect rect = new Rect(position.width - statusBarItemsWidth - m_ManagedDebuggerToggle.GetWidth(), 0, lightingBakeModeBarWidth, barHeight);

                if (rect.Contains(Event.current.mousePosition))
                {
                    Event.current.Use();
                    LightingWindow.CreateLightingWindow();
                }
            }

            string statusText = LogEntries.GetStatusText();

            if (statusText != null)
            {
                // Render
                int      mask       = LogEntries.GetStatusMask();
                GUIStyle errorStyle = ConsoleWindow.GetStatusStyleForErrorMode(mask);

                Texture2D icon = ConsoleWindow.GetIconForErrorMode(mask, false);
                GUILayout.Label(icon, errorStyle);

                GUILayout.Space(2);
                GUILayout.BeginVertical();
                GUILayout.Space(1);

                float statusTextWidth = GUIView.current.position.width - statusBarItemsWidth - m_ManagedDebuggerToggle.GetWidth() - (icon != null ? icon.width : 0);
                GUILayout.Label(statusText, errorStyle, GUILayout.MaxWidth(statusTextWidth));

                GUILayout.FlexibleSpace();

                GUILayout.EndVertical();

                // Handle status bar click
                if (Event.current.type == EventType.MouseDown)
                {
                    Rect rect = new Rect(0, 0, statusTextWidth, barHeight);
                    if (rect.Contains(Event.current.mousePosition))
                    {
                        Event.current.Use();
                        LogEntries.ClickStatusBar(Event.current.clickCount);
                        GUIUtility.ExitGUI();
                    }
                }
            }

            float managedDebuggerTogglePosX = position.width - statusWheelWidth - m_ManagedDebuggerToggle.GetWidth();

            m_ManagedDebuggerToggle.OnGUI(managedDebuggerTogglePosX, 0);

            GUILayout.EndHorizontal();

            if (Event.current.type == EventType.Repaint)
            {
                float progressBarHorizontalPosition = position.width - statusWheelWidth - m_ManagedDebuggerToggle.GetWidth();

                if (AsyncProgressBar.isShowing)
                {
                    progressBarHorizontalPosition -= progressBarWidth + spacing;
                    EditorGUI.ProgressBar(new Rect(progressBarHorizontalPosition, 0, progressBarWidth, barHeight), AsyncProgressBar.progress, AsyncProgressBar.progressInfo);
                }

                if (showBakeMode)
                {
                    GUI.Label(new Rect(progressBarHorizontalPosition - lightingBakeModeBarWidth - spacing, 0, lightingBakeModeBarWidth, barHeight), m_BakeModeString, EditorStyles.progressBarText);
                    progressBarHorizontalPosition -= lightingBakeModeBarWidth + spacing;
                }

                if (compiling)
                {
                    if (assembliesLocked)
                    {
                        GUI.Label(new Rect(position.width - statusWheelWidth, 0, s_AssemblyLock.image.width, s_AssemblyLock.image.height), s_AssemblyLock, GUIStyle.none);
                    }
                    else
                    {
                        int frame = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10, 11.99f);
                        GUI.Label(new Rect(position.width - statusWheelWidth, 0, s_StatusWheel[frame].image.width, s_StatusWheel[frame].image.height), s_StatusWheel[frame], GUIStyle.none);
                    }
                }

                if (Unsupported.IsBleedingEdgeBuild())
                {
                    var backup = GUI.color;
                    GUI.color = Color.yellow;
                    GUI.Label(new Rect(progressBarHorizontalPosition - 310 - spacing, 0, 310, barHeight), "THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD");
                    GUI.color = backup;
                }
                else if (Unsupported.IsDeveloperMode())
                {
                    GUI.Label(new Rect(progressBarHorizontalPosition - 300 - spacing, 0, 300, barHeight), m_MiniMemoryOverview, EditorStyles.progressBarText);
                    EditorGUIUtility.CleanCache(m_MiniMemoryOverview);
                }
            }

            DoWindowDecorationEnd();

            EditorGUI.ShowRepaints();
        }
示例#4
0
        protected override void OldOnGUI()
        {
            ConsoleWindow.LoadIcons();
            if (background == null)
            {
                background = "AppToolbar";
            }

            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                GUI.color = HostView.kPlayModeDarken;
            }

            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            var compiling        = EditorApplication.isCompiling;
            var assembliesLocked = !EditorApplication.CanReloadAssemblies();

            GUILayout.Space(2);
            GUILayout.BeginHorizontal();
            GUILayout.Space(2);

            string statusText = LogEntries.GetStatusText();

            if (statusText != null)
            {
                // Render
                int      mask       = LogEntries.GetStatusMask();
                GUIStyle errorStyle = ConsoleWindow.GetStatusStyleForErrorMode(mask);

                GUILayout.Label(ConsoleWindow.GetIconForErrorMode(mask, false), errorStyle);

                GUILayout.Space(2);
                GUILayout.BeginVertical();
                GUILayout.Space(2);

                if (compiling) //leave space for indicator
                {
                    GUILayout.Label(statusText, errorStyle, GUILayout.MaxWidth(GUIView.current.position.width - 52));
                }
                else
                {
                    GUILayout.Label(statusText, errorStyle);
                }
                GUILayout.FlexibleSpace();

                GUILayout.EndVertical();

                // Handle status bar click
                if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                    LogEntries.ClickStatusBar(Event.current.clickCount);
                    GUIUtility.ExitGUI();
                }
            }

            GUILayout.EndHorizontal();

            if (Event.current.type == EventType.Repaint)
            {
                const float statusWheelWidth = 24;
                const float progressBarStatusWheelSpacing = 3;

                float progressBarHorizontalPosition = position.width - statusWheelWidth;
                if (AsyncProgressBar.isShowing)
                {
                    const int progressBarWidth = 185;
                    progressBarHorizontalPosition -= progressBarWidth + progressBarStatusWheelSpacing;
                    EditorGUI.ProgressBar(new Rect(progressBarHorizontalPosition, 0, progressBarWidth, 19), AsyncProgressBar.progress, AsyncProgressBar.progressInfo);
                }

                if (compiling)
                {
                    if (assembliesLocked)
                    {
                        GUI.Label(new Rect(position.width - statusWheelWidth, 0, s_AssemblyLock.image.width, s_AssemblyLock.image.height), s_AssemblyLock, GUIStyle.none);
                    }
                    else
                    {
                        int frame = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10, 11.99f);
                        GUI.Label(new Rect(position.width - statusWheelWidth, 0, s_StatusWheel[frame].image.width, s_StatusWheel[frame].image.height), s_StatusWheel[frame], GUIStyle.none);
                    }
                }

                if (Unsupported.IsBleedingEdgeBuild())
                {
                    var backup = GUI.color;
                    GUI.color = Color.yellow;
                    GUI.Label(new Rect(progressBarHorizontalPosition - 310, 0, 310, 19), "THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD");
                    GUI.color = backup;
                }
                else if (Unsupported.IsDeveloperMode())
                {
                    GUI.Label(new Rect(progressBarHorizontalPosition - 200, 0, 200, 19), m_LastMiniMemoryOverview, EditorStyles.progressBarText);
                    EditorGUIUtility.CleanCache(m_LastMiniMemoryOverview);
                }
            }

            DoWindowDecorationEnd();

            EditorGUI.ShowRepaints();
        }