DebuggerComponent.InputTouchInformationWindow.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 InputTouchInformationWindow : ScrollableDebuggerWindowBase
  14. {
  15. protected override void OnDrawScrollableWindow()
  16. {
  17. GUILayout.Label("<b>Input Touch Information</b>");
  18. GUILayout.BeginVertical("box");
  19. {
  20. DrawItem("Touch Supported", Input.touchSupported.ToString());
  21. DrawItem("Touch Pressure Supported", Input.touchPressureSupported.ToString());
  22. DrawItem("Stylus Touch Supported", Input.stylusTouchSupported.ToString());
  23. DrawItem("Simulate Mouse With Touches", Input.simulateMouseWithTouches.ToString());
  24. DrawItem("Multi Touch Enabled", Input.multiTouchEnabled.ToString());
  25. DrawItem("Touch Count", Input.touchCount.ToString());
  26. DrawItem("Touches", GetTouchesString(Input.touches));
  27. }
  28. GUILayout.EndVertical();
  29. }
  30. private string GetTouchString(Touch touch)
  31. {
  32. return Utility.Text.Format("{0}, {1}, {2}, {3}, {4}", touch.position.ToString(), touch.deltaPosition.ToString(), touch.rawPosition.ToString(), touch.pressure.ToString(), touch.phase.ToString());
  33. }
  34. private string GetTouchesString(Touch[] touches)
  35. {
  36. string[] touchStrings = new string[touches.Length];
  37. for (int i = 0; i < touches.Length; i++)
  38. {
  39. touchStrings[i] = GetTouchString(touches[i]);
  40. }
  41. return string.Join("; ", touchStrings);
  42. }
  43. }
  44. }
  45. }