DebuggerComponent.InputAccelerationInformationWindow.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 GameFramework;
  8. using UnityEngine;
  9. namespace UnityGameFramework.Runtime
  10. {
  11. public sealed partial class DebuggerComponent : GameFrameworkComponent
  12. {
  13. private sealed class InputAccelerationInformationWindow : ScrollableDebuggerWindowBase
  14. {
  15. protected override void OnDrawScrollableWindow()
  16. {
  17. GUILayout.Label("<b>Input Acceleration Information</b>");
  18. GUILayout.BeginVertical("box");
  19. {
  20. DrawItem("Acceleration", Input.acceleration.ToString());
  21. DrawItem("Acceleration Event Count", Input.accelerationEventCount.ToString());
  22. DrawItem("Acceleration Events", GetAccelerationEventsString(Input.accelerationEvents));
  23. }
  24. GUILayout.EndVertical();
  25. }
  26. private string GetAccelerationEventString(AccelerationEvent accelerationEvent)
  27. {
  28. return Utility.Text.Format("{0}, {1}", accelerationEvent.acceleration.ToString(), accelerationEvent.deltaTime.ToString());
  29. }
  30. private string GetAccelerationEventsString(AccelerationEvent[] accelerationEvents)
  31. {
  32. string[] accelerationEventStrings = new string[accelerationEvents.Length];
  33. for (int i = 0; i < accelerationEvents.Length; i++)
  34. {
  35. accelerationEventStrings[i] = GetAccelerationEventString(accelerationEvents[i]);
  36. }
  37. return string.Join("; ", accelerationEventStrings);
  38. }
  39. }
  40. }
  41. }