DebuggerComponent.TimeInformationWindow.cs 3.1 KB

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