TERPGDemo/RPGDemo/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.InputAccelerationInformationWindow.cs
2025-04-22 17:16:40 +08:00

39 lines
1.5 KiB
C#

using UnityEngine;
namespace TEngine
{
public sealed partial class Debugger
{
private sealed class InputAccelerationInformationWindow : ScrollableDebuggerWindowBase
{
protected override void OnDrawScrollableWindow()
{
GUILayout.Label("<b>Input Acceleration Information</b>");
GUILayout.BeginVertical("box");
{
DrawItem("Acceleration", Input.acceleration.ToString());
DrawItem("Acceleration Event Count", Input.accelerationEventCount.ToString());
DrawItem("Acceleration Events", GetAccelerationEventsString(Input.accelerationEvents));
}
GUILayout.EndVertical();
}
private string GetAccelerationEventString(AccelerationEvent accelerationEvent)
{
return Utility.Text.Format("{0}, {1}", accelerationEvent.acceleration, accelerationEvent.deltaTime);
}
private string GetAccelerationEventsString(AccelerationEvent[] accelerationEvents)
{
string[] accelerationEventStrings = new string[accelerationEvents.Length];
for (int i = 0; i < accelerationEvents.Length; i++)
{
accelerationEventStrings[i] = GetAccelerationEventString(accelerationEvents[i]);
}
return string.Join("; ", accelerationEventStrings);
}
}
}
}