コード例 #1
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);
            }
        }
コード例 #2
0
 private void DrawSpecialModeLabel()
 {
     if (Unsupported.IsBleedingEdgeBuild())
     {
         GUILayout.Space(k_SpaceBeforeProgress);
         m_SpecialModeLabel = "THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD";
         var backup = GUI.color;
         GUI.color = Color.yellow;
         GUILayout.Label(m_SpecialModeLabel);
         GUI.color = backup;
     }
     else if (Unsupported.IsDeveloperMode())
     {
         GUILayout.Space(k_SpaceBeforeProgress);
         m_SpecialModeLabel = m_MiniMemoryOverview;
         GUILayout.Label(m_SpecialModeLabel, Styles.statusLabel);
         EditorGUIUtility.CleanCache(m_MiniMemoryOverview);
     }
     else
     {
         m_SpecialModeLabel = "";
     }
 }
コード例 #3
0
        private void OnGUI()
        {
            ConsoleWindow.LoadIcons();
            if (background == null)
            {
                background = "AppToolbar";
            }
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                GUI.color = (Color)HostView.kPlayModeDarken;
            }
            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(new Rect(0f, 0f, base.position.width, base.position.height), false, false, false, false);
            }
            bool isCompiling = EditorApplication.isCompiling;

            GUILayout.Space(2f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(2f);
            string statusText = LogEntries.GetStatusText();

            if (statusText != null)
            {
                int      statusMask = LogEntries.GetStatusMask();
                GUIStyle statusStyleForErrorMode = ConsoleWindow.GetStatusStyleForErrorMode(statusMask);
                GUILayout.Label(ConsoleWindow.GetIconForErrorMode(statusMask, false), statusStyleForErrorMode, new GUILayoutOption[0]);
                GUILayout.Space(2f);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Space(2f);
                if (isCompiling)
                {
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth(GUIView.current.position.width - 52f) };
                    GUILayout.Label(statusText, statusStyleForErrorMode, options);
                }
                else
                {
                    GUILayout.Label(statusText, statusStyleForErrorMode, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndVertical();
                if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                    LogEntries.ClickStatusBar(Event.current.clickCount);
                    GUIUtility.ExitGUI();
                }
            }
            GUILayout.EndHorizontal();
            if (Event.current.type == EventType.Repaint)
            {
                float x = base.position.width - 24f;
                if (AsyncProgressBar.isShowing)
                {
                    x -= 188f;
                    EditorGUI.ProgressBar(new Rect(x, 0f, 185f, 19f), AsyncProgressBar.progress, AsyncProgressBar.progressInfo);
                }
                if (isCompiling)
                {
                    int index = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10f, 11.99f);
                    GUI.Label(new Rect(base.position.width - 24f, 0f, (float)s_StatusWheel[index].image.width, (float)s_StatusWheel[index].image.height), s_StatusWheel[index], GUIStyle.none);
                }
                if (Unsupported.IsBleedingEdgeBuild())
                {
                    Color color = GUI.color;
                    GUI.color = Color.yellow;
                    GUI.Label(new Rect(x - 310f, 0f, 310f, 19f), "THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD");
                    GUI.color = color;
                }
                else if (Unsupported.IsDeveloperBuild())
                {
                    GUI.Label(new Rect(x - 200f, 0f, 200f, 19f), this.m_LastMiniMemoryOverview, EditorStyles.progressBarText);
                    EditorGUIUtility.CleanCache(this.m_LastMiniMemoryOverview);
                }
            }
            base.DoWindowDecorationEnd();
            EditorGUI.ShowRepaints();
        }
コード例 #4
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();
        }
コード例 #5
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);
            }

            bool compiling = EditorApplication.isCompiling;

            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)
                {
                    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();
        }