com.alicizax.unity.framework/Runtime/Debugger/DebuggerComponent.TimeInformationWindow.cs
2025-09-05 19:46:30 +08:00

71 lines
2.7 KiB
C#

using AlicizaX;
using UnityEngine;
namespace AlicizaX.Debugger.Runtime
{
public sealed partial class DebuggerComponent
{
private sealed class TimeInformationWindow : ScrollableDebuggerWindowBase
{
protected override void OnDrawScrollableWindow()
{
GUILayout.Label("<b>Time Information</b>");
GUILayout.BeginVertical("box");
{
DrawItem("Time Scale", Utility.Text.Format("{0} [{1}]", Time.timeScale, GetTimeScaleDescription(Time.timeScale)));
DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString());
DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString());
DrawItem("Time", Time.time.ToString());
DrawItem("Fixed Time", Time.fixedTime.ToString());
DrawItem("Unscaled Time", Time.unscaledTime.ToString());
#if UNITY_5_6_OR_NEWER
DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString());
#endif
DrawItem("Delta Time", Time.deltaTime.ToString());
DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString());
DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString());
#if UNITY_5_6_OR_NEWER
DrawItem("Fixed Unscaled Delta Time", Time.fixedUnscaledDeltaTime.ToString());
#endif
DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString());
DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString());
#if UNITY_5_5_OR_NEWER
DrawItem("Maximum Particle Delta Time", Time.maximumParticleDeltaTime.ToString());
#endif
DrawItem("Frame Count", Time.frameCount.ToString());
DrawItem("Rendered Frame Count", Time.renderedFrameCount.ToString());
DrawItem("Capture Framerate", Time.captureFramerate.ToString());
#if UNITY_2019_2_OR_NEWER
DrawItem("Capture Delta Time", Time.captureDeltaTime.ToString());
#endif
#if UNITY_5_6_OR_NEWER
DrawItem("In Fixed Time Step", Time.inFixedTimeStep.ToString());
#endif
}
GUILayout.EndVertical();
}
private string GetTimeScaleDescription(float timeScale)
{
if (timeScale <= 0f)
{
return "Pause";
}
if (timeScale < 1f)
{
return "Slower";
}
if (timeScale > 1f)
{
return "Faster";
}
return "Normal";
}
}
}
}