com.alicizax.unity.framework/Runtime/Debugger/DebuggerComponent.InputCompassInformationWindow.cs
陈思海 3f895266f1 重构Runtime模式下Debugg模块为UI ToolKit绘制
重构Runtime模式下Debugg模块为UI ToolKit绘制
2026-04-21 13:01:55 +08:00

35 lines
1.6 KiB
C#

using UnityEngine;
using UnityEngine.UIElements;
namespace AlicizaX.Debugger.Runtime
{
public sealed partial class DebuggerComponent
{
private sealed class InputCompassInformationWindow : PollingDebuggerWindowBase
{
protected override void BuildWindow(VisualElement root)
{
VisualElement actions = CreateSection("Actions", out VisualElement actionCard);
VisualElement toolbar = CreateToolbarRow();
toolbar.Add(CreateActionButton("Enable", () => Input.compass.enabled = true, DebuggerTheme.ButtonSurface));
toolbar.Add(CreateActionButton("Disable", () => Input.compass.enabled = false, DebuggerTheme.ButtonSurface));
actionCard.Add(toolbar);
root.Add(actions);
VisualElement section = CreateSection("Input Compass", out VisualElement card);
card.Add(CreateRow("Enabled", Input.compass.enabled.ToString()));
if (Input.compass.enabled)
{
card.Add(CreateRow("Heading Accuracy", Input.compass.headingAccuracy.ToString()));
card.Add(CreateRow("Magnetic Heading", Input.compass.magneticHeading.ToString()));
card.Add(CreateRow("Raw Vector", Input.compass.rawVector.ToString()));
card.Add(CreateRow("Timestamp", Input.compass.timestamp.ToString()));
card.Add(CreateRow("True Heading", Input.compass.trueHeading.ToString()));
}
root.Add(section);
}
}
}
}