DebuggerComponent.InputGyroscopeInformationWindow.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 UnityEngine;
  8. namespace UnityGameFramework.Runtime
  9. {
  10. public sealed partial class DebuggerComponent : GameFrameworkComponent
  11. {
  12. private sealed class InputGyroscopeInformationWindow : ScrollableDebuggerWindowBase
  13. {
  14. protected override void OnDrawScrollableWindow()
  15. {
  16. GUILayout.Label("<b>Input Gyroscope Information</b>");
  17. GUILayout.BeginVertical("box");
  18. {
  19. GUILayout.BeginHorizontal();
  20. {
  21. if (GUILayout.Button("Enable", GUILayout.Height(30f)))
  22. {
  23. Input.gyro.enabled = true;
  24. }
  25. if (GUILayout.Button("Disable", GUILayout.Height(30f)))
  26. {
  27. Input.gyro.enabled = false;
  28. }
  29. }
  30. GUILayout.EndHorizontal();
  31. DrawItem("Enabled", Input.gyro.enabled.ToString());
  32. if (Input.gyro.enabled)
  33. {
  34. DrawItem("Update Interval", Input.gyro.updateInterval.ToString());
  35. DrawItem("Attitude", Input.gyro.attitude.eulerAngles.ToString());
  36. DrawItem("Gravity", Input.gyro.gravity.ToString());
  37. DrawItem("Rotation Rate", Input.gyro.rotationRate.ToString());
  38. DrawItem("Rotation Rate Unbiased", Input.gyro.rotationRateUnbiased.ToString());
  39. DrawItem("User Acceleration", Input.gyro.userAcceleration.ToString());
  40. }
  41. }
  42. GUILayout.EndVertical();
  43. }
  44. }
  45. }
  46. }