DebuggerComponent.InputTouchInformationWindow.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //------------------------------------------------------------
  2. // Game Framework v3.x
  3. // Copyright © 2013-2017 Jiang Yin. All rights reserved.
  4. // Homepage: http://gameframework.cn/
  5. // Feedback: mailto:jiangyin@gameframework.cn
  6. //------------------------------------------------------------
  7. using UnityEngine;
  8. namespace UnityGameFramework.Runtime
  9. {
  10. public partial class DebuggerComponent
  11. {
  12. private sealed class InputTouchInformationWindow : ScrollableDebuggerWindowBase
  13. {
  14. protected override void OnDrawScrollableWindow()
  15. {
  16. GUILayout.Label("<b>Input Touch Information</b>");
  17. GUILayout.BeginVertical("box");
  18. {
  19. DrawItem("Touch Supported:", Input.touchSupported.ToString());
  20. DrawItem("Touch Pressure Supported:", Input.touchPressureSupported.ToString());
  21. DrawItem("Stylus Touch Supported:", Input.stylusTouchSupported.ToString());
  22. DrawItem("Simulate Mouse With Touches:", Input.simulateMouseWithTouches.ToString());
  23. DrawItem("Multi Touch Enabled:", Input.multiTouchEnabled.ToString());
  24. DrawItem("Touch Count:", Input.touchCount.ToString());
  25. DrawItem("Touches:", GetTouchesString(Input.touches));
  26. }
  27. GUILayout.EndVertical();
  28. }
  29. private string GetTouchString(Touch touch)
  30. {
  31. return string.Format("{0}, {1}, {2}, {3}, {4}", touch.position.ToString(), touch.deltaPosition.ToString(), touch.rawPosition.ToString(), touch.pressure.ToString(), touch.phase.ToString());
  32. }
  33. private string GetTouchesString(Touch[] touches)
  34. {
  35. string[] touchStrings = new string[touches.Length];
  36. for (int i = 0; i < touches.Length; i++)
  37. {
  38. touchStrings[i] = GetTouchString(touches[i]);
  39. }
  40. return string.Join("; ", touchStrings);
  41. }
  42. }
  43. }
  44. }