GameInfoDebugGUI.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using UnityEngine;
  3. public class GameInfoDebugGUI : DebugGuiBase
  4. {
  5. protected override string UIDebugButtonName
  6. {
  7. get
  8. {
  9. return "FPS显示";
  10. }
  11. }
  12. protected override void GUIStart()
  13. {
  14. this.InVisible = UnityEngine.Debug.isDebugBuild;
  15. }
  16. private void Update()
  17. {
  18. }
  19. public override void OnDebugGUI()
  20. {
  21. if (this._debugBoxStyle == null)
  22. {
  23. this._debugBoxStyle = GUI.skin.box;
  24. this._debugBoxStyle.alignment = TextAnchor.UpperLeft;
  25. }
  26. GUI.depth = 0;
  27. GUI.Label(new Rect(10f, (float)(Screen.height - 120), 400f, 200f), "FPS : " + WorldTime.Fps.ToString("f2"));
  28. GUI.Label(new Rect(10f, (float)(Screen.height - 120 + 20), 400f, 200f), "Physic FPS : " + WorldTime.PhysicsFps.ToString("f2"));
  29. if (SingletonMono<WorldTime>.Instance != null)
  30. {
  31. GUI.Label(new Rect(10f, (float)(Screen.height - 120 + 40), 400f, 200f), "Level Time : " + WorldTime.LevelTime.ToString("f2"));
  32. }
  33. GUI.Label(new Rect(10f, (float)(Screen.height - 120 + 60), 400f, 200f), "Scene Name : " + UITools.SceneName);
  34. GUI.Label(new Rect(10f, (float)(Screen.height - 120 + 80), 400f, 200f), "Mode : " + R.Mode.CurrentMode);
  35. }
  36. private GUIStyle _debugBoxStyle;
  37. }