Ejemplo n.º 1
0
        private void DrawProgressBar()
        {
            if (!showProgress)
            {
                return;
            }

            GUILayout.Space(k_SpaceBeforeProgress);

            var buttonRect = GUILayoutUtility.GetLastRect();

            EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);

            // Define the progress styles to be used based on the current progress state.
            var globalProgress     = Progress.globalProgress;
            var progressBarStyle   = GetProgressBarStyle(globalProgress);
            var progressBarContent = GetProgressBarContent(m_ProgressStatus);
            var progressRect       = EditorGUILayout.GetControlRect(false, position.height, Styles.progressBarBack, Styles.progressBarWidth);

            if (EditorGUI.ProgressBar(progressRect, globalProgress, progressBarContent, true,
                                      Styles.progressBarBack, progressBarStyle, Styles.progressBarText))
            {
                Progress.ShowDetails();
            }

            if (globalProgress == -1.0f)
            {
                EditorApplication.delayCall += () => Repaint();
            }

            EditorGUIUtility.AddCursorRect(progressRect, MouseCursor.Link);
            GUILayout.Space(k_SpaceAfterProgress);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
        private void DrawProgressBar()
        {
            if (!showProgress)
            {
                return;
            }

            GUILayout.Space(k_SpaceBeforeProgress);
            if (GUILayout.Button(m_ProgressStatus, Styles.statusLabel))
            {
                Progress.ShowDetails();
            }

            var buttonRect = GUILayoutUtility.GetLastRect();

            EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);

            // Define the progress styles to be used based on the current progress state.
            Color oldColor = GUI.color;

            if (m_CurrentProgressNotResponding)
            {
                var fade = Mathf.Min(Mathf.Max(0.25f, Mathf.Cos((float)EditorApplication.timeSinceStartup * 2.0f) / 2.0f + 0.75f), 0.85f);
                GUI.color = new Color(fade, fade, fade);
            }
            var globalProgress     = Progress.globalProgress;
            var progressBarStyle   = GetProgressBarStyle(globalProgress);
            var progressBarContent = GetProgressBarContent(globalProgress, m_ProgressPercentageStatus);
            var progressRect       = EditorGUILayout.GetControlRect(false, position.height, Styles.progressBarBack, Styles.progressBarWidth);

            if (EditorGUI.ProgressBar(progressRect, globalProgress, progressBarContent, true,
                                      Styles.progressBarBack, progressBarStyle, Styles.progressBarText))
            {
                Progress.ShowDetails();
            }

            GUI.color = oldColor;

            if (globalProgress == -1.0f)
            {
                EditorApplication.delayCall += () => Repaint();
            }

            EditorGUIUtility.AddCursorRect(progressRect, MouseCursor.Link);
            GUILayout.Space(k_SpaceAfterProgress);
        }
Ejemplo n.º 4
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);
            }
        }