UpdateFrameTime() private static method

private static UpdateFrameTime ( ) : void
return void
Ejemplo n.º 1
0
        public static void GameViewStatsGUI()
        {
            GUI.skin  = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
            GUI.color = new Color(1f, 1f, 1f, 0.75f);
            float width  = 300f;
            float height = 204f;
            int   length = Network.connections.Length;

            if (length != 0)
            {
                height += 220f;
            }
            GUILayout.BeginArea(new Rect((float)((double)GUIView.current.position.width - (double)width - 10.0), 27f, width, height), "Statistics", GUI.skin.window);
            GUILayout.Label("Audio:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
            StringBuilder stringBuilder1 = new StringBuilder(400);
            float         audioLevel     = UnityStats.audioLevel;

            stringBuilder1.Append("  Level: " + GameViewGUI.FormatDb(audioLevel) + (!EditorUtility.audioMasterMute ? "\n" : " (MUTED)\n"));
            stringBuilder1.Append(string.Format("  Clipping: {0:F1}%", (object)(float)(100.0 * (double)UnityStats.audioClippingAmount)));
            GUILayout.Label(stringBuilder1.ToString());
            GUI.Label(new Rect(170f, 40f, 120f, 20f), string.Format("DSP load: {0:F1}%", (object)(float)(100.0 * (double)UnityStats.audioDSPLoad)));
            GUI.Label(new Rect(170f, 53f, 120f, 20f), string.Format("Stream load: {0:F1}%", (object)(float)(100.0 * (double)UnityStats.audioStreamLoad)));
            GUILayout.Label("Graphics:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
            GameViewGUI.UpdateFrameTime();
            GUI.Label(new Rect(170f, 75f, 120f, 20f), string.Format("{0:F1} FPS ({1:F1}ms)", (object)(float)(1.0 / (double)Mathf.Max(GameViewGUI.m_MaxFrameTime, 1E-05f)), (object)(float)((double)GameViewGUI.m_MaxFrameTime * 1000.0)));
            int           screenBytes    = UnityStats.screenBytes;
            int           num1           = UnityStats.dynamicBatchedDrawCalls - UnityStats.dynamicBatches;
            int           num2           = UnityStats.staticBatchedDrawCalls - UnityStats.staticBatches;
            StringBuilder stringBuilder2 = new StringBuilder(400);

            if ((double)GameViewGUI.m_ClientFrameTime > (double)GameViewGUI.m_RenderFrameTime)
            {
                stringBuilder2.Append(string.Format("  CPU: main <b>{0:F1}</b>ms  render thread {1:F1}ms\n", (object)(float)((double)GameViewGUI.m_ClientFrameTime * 1000.0), (object)(float)((double)GameViewGUI.m_RenderFrameTime * 1000.0)));
            }
            else
            {
                stringBuilder2.Append(string.Format("  CPU: main {0:F1}ms  render thread <b>{1:F1}</b>ms\n", (object)(float)((double)GameViewGUI.m_ClientFrameTime * 1000.0), (object)(float)((double)GameViewGUI.m_RenderFrameTime * 1000.0)));
            }
            stringBuilder2.Append(string.Format("  Batches: <b>{0}</b> \tSaved by batching: {1}\n", (object)UnityStats.batches, (object)(num1 + num2)));
            stringBuilder2.Append(string.Format("  Tris: {0} \tVerts: {1} \n", (object)GameViewGUI.FormatNumber(UnityStats.triangles), (object)GameViewGUI.FormatNumber(UnityStats.vertices)));
            stringBuilder2.Append(string.Format("  Screen: {0} - {1}\n", (object)UnityStats.screenRes, (object)EditorUtility.FormatBytes(screenBytes)));
            stringBuilder2.Append(string.Format("  SetPass calls: {0} \tShadow casters: {1} \n", (object)UnityStats.setPassCalls, (object)UnityStats.shadowCasters));
            stringBuilder2.Append(string.Format("  Visible skinned meshes: {0}  Animations: {1}", (object)UnityStats.visibleSkinnedMeshes, (object)UnityStats.visibleAnimations));
            GUILayout.Label(stringBuilder2.ToString(), GameViewGUI.labelStyle, new GUILayoutOption[0]);
            if (length != 0)
            {
                GUILayout.Label("Network:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
                GUILayout.BeginHorizontal();
                for (int i = 0; i < length; ++i)
                {
                    GUILayout.Label(UnityStats.GetNetworkStats(i));
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.Label("Network: (no players connected)", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
            }
            GUILayout.EndArea();
        }
Ejemplo n.º 2
0
        public static void GameViewStatsGUI()
        {
            GUI.skin  = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
            GUI.color = new Color(1f, 1f, 1f, 0.75f);
            float num  = 300f;
            float num2 = 204f;
            int   num3 = Network.connections.Length;

            if (num3 != 0)
            {
                num2 += 220f;
            }
            GUILayout.BeginArea(new Rect(GUIView.current.position.width - num - 10f, 27f, num, num2), "Statistics", GUI.skin.window);
            GUILayout.Label("Audio:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
            StringBuilder stringBuilder = new StringBuilder(400);
            float         audioLevel    = UnityStats.audioLevel;

            stringBuilder.Append("  Level: " + GameViewGUI.FormatDb(audioLevel) + ((!EditorUtility.audioMasterMute) ? "\n" : " (MUTED)\n"));
            stringBuilder.Append(string.Format("  Clipping: {0:F1}%", 100f * UnityStats.audioClippingAmount));
            GUILayout.Label(stringBuilder.ToString(), new GUILayoutOption[0]);
            GUI.Label(new Rect(170f, 40f, 120f, 20f), string.Format("DSP load: {0:F1}%", 100f * UnityStats.audioDSPLoad));
            GUI.Label(new Rect(170f, 53f, 120f, 20f), string.Format("Stream load: {0:F1}%", 100f * UnityStats.audioStreamLoad));
            GUILayout.Label("Graphics:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
            GameViewGUI.UpdateFrameTime();
            string text = string.Format("{0:F1} FPS ({1:F1}ms)", 1f / Mathf.Max(GameViewGUI.m_MaxFrameTime, 1E-05f), GameViewGUI.m_MaxFrameTime * 1000f);

            GUI.Label(new Rect(170f, 75f, 120f, 20f), text);
            int           screenBytes    = UnityStats.screenBytes;
            int           num4           = UnityStats.dynamicBatchedDrawCalls - UnityStats.dynamicBatches;
            int           num5           = UnityStats.staticBatchedDrawCalls - UnityStats.staticBatches;
            int           num6           = UnityStats.instancedBatchedDrawCalls - UnityStats.instancedBatches;
            StringBuilder stringBuilder2 = new StringBuilder(400);

            if (GameViewGUI.m_ClientFrameTime > GameViewGUI.m_RenderFrameTime)
            {
                stringBuilder2.Append(string.Format("  CPU: main <b>{0:F1}</b>ms  render thread {1:F1}ms\n", GameViewGUI.m_ClientFrameTime * 1000f, GameViewGUI.m_RenderFrameTime * 1000f));
            }
            else
            {
                stringBuilder2.Append(string.Format("  CPU: main {0:F1}ms  render thread <b>{1:F1}</b>ms\n", GameViewGUI.m_ClientFrameTime * 1000f, GameViewGUI.m_RenderFrameTime * 1000f));
            }
            stringBuilder2.Append(string.Format("  Batches: <b>{0}</b> \tSaved by batching: {1}\n", UnityStats.batches, num4 + num5 + num6));
            stringBuilder2.Append(string.Format("  Tris: {0} \tVerts: {1} \n", GameViewGUI.FormatNumber(UnityStats.trianglesLong), GameViewGUI.FormatNumber(UnityStats.verticesLong)));
            stringBuilder2.Append(string.Format("  Screen: {0} - {1}\n", UnityStats.screenRes, EditorUtility.FormatBytes(screenBytes)));
            stringBuilder2.Append(string.Format("  SetPass calls: {0} \tShadow casters: {1} \n", UnityStats.setPassCalls, UnityStats.shadowCasters));
            stringBuilder2.Append(string.Format("  Visible skinned meshes: {0}  Animations: {1}", UnityStats.visibleSkinnedMeshes, UnityStats.visibleAnimations));
            GUILayout.Label(stringBuilder2.ToString(), GameViewGUI.labelStyle, new GUILayoutOption[0]);
            if (num3 != 0)
            {
                GUILayout.Label("Network:", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                for (int i = 0; i < num3; i++)
                {
                    GUILayout.Label(UnityStats.GetNetworkStats(i), new GUILayoutOption[0]);
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.Label("Network: (no players connected)", GameViewGUI.sectionHeaderStyle, new GUILayoutOption[0]);
            }
            GUILayout.EndArea();
        }