com.alicizax.unity.framework/Runtime/Debugger/DebuggerComponent.InputGyroscopeInformationWindow.cs

36 lines
1.7 KiB
C#
Raw Normal View History

2025-09-05 19:46:30 +08:00
using UnityEngine;
using UnityEngine.UIElements;
2025-09-05 19:46:30 +08:00
namespace AlicizaX.Debugger.Runtime
{
public sealed partial class DebuggerComponent
{
private sealed class InputGyroscopeInformationWindow : PollingDebuggerWindowBase
2025-09-05 19:46:30 +08:00
{
protected override void BuildWindow(VisualElement root)
2025-09-05 19:46:30 +08:00
{
VisualElement actions = CreateSection("Actions", out VisualElement actionCard);
VisualElement toolbar = CreateToolbarRow();
toolbar.Add(CreateActionButton("Enable", () => Input.gyro.enabled = true, DebuggerTheme.ButtonSurface));
toolbar.Add(CreateActionButton("Disable", () => Input.gyro.enabled = false, DebuggerTheme.ButtonSurface));
actionCard.Add(toolbar);
root.Add(actions);
2025-09-05 19:46:30 +08:00
VisualElement section = CreateSection("Input Gyroscope", out VisualElement card);
card.Add(CreateRow("Enabled", Input.gyro.enabled.ToString()));
if (Input.gyro.enabled)
{
card.Add(CreateRow("Update Interval", Input.gyro.updateInterval.ToString()));
card.Add(CreateRow("Attitude", Input.gyro.attitude.eulerAngles.ToString()));
card.Add(CreateRow("Gravity", Input.gyro.gravity.ToString()));
card.Add(CreateRow("Rotation Rate", Input.gyro.rotationRate.ToString()));
card.Add(CreateRow("Rotation Rate Unbiased", Input.gyro.rotationRateUnbiased.ToString()));
card.Add(CreateRow("User Acceleration", Input.gyro.userAcceleration.ToString()));
2025-09-05 19:46:30 +08:00
}
root.Add(section);
2025-09-05 19:46:30 +08:00
}
}
}
}