DebuggerComponent.TimeInformationWindow.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //------------------------------------------------------------
  2. // Game Framework v3.x
  3. // Copyright © 2013-2017 Jiang Yin. All rights reserved.
  4. // Homepage: http://gameframework.cn/
  5. // Feedback: mailto:jiangyin@gameframework.cn
  6. //------------------------------------------------------------
  7. using UnityEngine;
  8. namespace UnityGameFramework.Runtime
  9. {
  10. public partial class DebuggerComponent
  11. {
  12. private sealed class TimeInformationWindow : ScrollableDebuggerWindowBase
  13. {
  14. protected override void OnDrawScrollableWindow()
  15. {
  16. GUILayout.Label("<b>Time Information</b>");
  17. GUILayout.BeginVertical("box");
  18. {
  19. DrawItem("Time Scale", string.Format("{0} [{1}]", Time.timeScale.ToString(), GetTimeScaleDescription(Time.timeScale)));
  20. DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString());
  21. DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString());
  22. DrawItem("Time", Time.time.ToString());
  23. DrawItem("Fixed Time", Time.fixedTime.ToString());
  24. DrawItem("Unscaled Time", Time.unscaledTime.ToString());
  25. #if UNITY_5_6_OR_NEWER
  26. DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString());
  27. #endif
  28. DrawItem("Delta Time", Time.deltaTime.ToString());
  29. DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString());
  30. DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString());
  31. #if UNITY_5_6_OR_NEWER
  32. DrawItem("Fixed Unscaled Delta Time", Time.fixedUnscaledDeltaTime.ToString());
  33. #endif
  34. DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString());
  35. DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString());
  36. #if UNITY_5_5_OR_NEWER
  37. DrawItem("Maximum Particle Delta Time", Time.maximumParticleDeltaTime.ToString());
  38. #endif
  39. DrawItem("Frame Count", Time.frameCount.ToString());
  40. DrawItem("Rendered Frame Count", Time.renderedFrameCount.ToString());
  41. DrawItem("Capture Frame Rate", Time.captureFramerate.ToString());
  42. #if UNITY_5_6_OR_NEWER
  43. DrawItem("In Fixed Time Step", Time.inFixedTimeStep.ToString());
  44. #endif
  45. }
  46. GUILayout.EndVertical();
  47. }
  48. private string GetTimeScaleDescription(float timeScale)
  49. {
  50. if (timeScale <= 0f)
  51. {
  52. return "Pause";
  53. }
  54. if (timeScale < 1f)
  55. {
  56. return "Slower";
  57. }
  58. if (timeScale > 1f)
  59. {
  60. return "Faster";
  61. }
  62. return "Normal";
  63. }
  64. }
  65. }
  66. }