暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using UnityEngine.UI;
  2. namespace UnityEngine.EventSystems
  3. {
  4. /// <summary>
  5. /// Interface to the Input system used by the BaseInputModule. With this it is possible to bypass the Input system with your own but still use the same InputModule. For example this can be used to feed fake input into the UI or interface with a different input system.
  6. /// </summary>
  7. public class BaseInput : UIBehaviour
  8. {
  9. /// <summary>
  10. /// Interface to Input.compositionString. Can be overridden to provide custom input instead of using the Input class.
  11. /// </summary>
  12. public virtual string compositionString
  13. {
  14. get { return Input.compositionString; }
  15. }
  16. /// <summary>
  17. /// Interface to Input.imeCompositionMode. Can be overridden to provide custom input instead of using the Input class.
  18. /// </summary>
  19. public virtual IMECompositionMode imeCompositionMode
  20. {
  21. get { return Input.imeCompositionMode; }
  22. set { Input.imeCompositionMode = value; }
  23. }
  24. /// <summary>
  25. /// Interface to Input.compositionCursorPos. Can be overridden to provide custom input instead of using the Input class.
  26. /// </summary>
  27. public virtual Vector2 compositionCursorPos
  28. {
  29. get { return Input.compositionCursorPos; }
  30. set { Input.compositionCursorPos = value; }
  31. }
  32. /// <summary>
  33. /// Interface to Input.mousePresent. Can be overridden to provide custom input instead of using the Input class.
  34. /// </summary>
  35. public virtual bool mousePresent
  36. {
  37. get { return Input.mousePresent; }
  38. }
  39. /// <summary>
  40. /// Interface to Input.GetMouseButtonDown. Can be overridden to provide custom input instead of using the Input class.
  41. /// </summary>
  42. /// <param name="button"></param>
  43. /// <returns></returns>
  44. public virtual bool GetMouseButtonDown(int button)
  45. {
  46. return Input.GetMouseButtonDown(button);
  47. }
  48. /// <summary>
  49. /// Interface to Input.GetMouseButtonUp. Can be overridden to provide custom input instead of using the Input class.
  50. /// </summary>
  51. public virtual bool GetMouseButtonUp(int button)
  52. {
  53. return Input.GetMouseButtonUp(button);
  54. }
  55. /// <summary>
  56. /// Interface to Input.GetMouseButton. Can be overridden to provide custom input instead of using the Input class.
  57. /// </summary>
  58. public virtual bool GetMouseButton(int button)
  59. {
  60. return Input.GetMouseButton(button);
  61. }
  62. /// <summary>
  63. /// Interface to Input.mousePosition. Can be overridden to provide custom input instead of using the Input class.
  64. /// </summary>
  65. public virtual Vector2 mousePosition
  66. {
  67. get { return Input.mousePosition; }
  68. }
  69. /// <summary>
  70. /// Interface to Input.mouseScrollDelta. Can be overridden to provide custom input instead of using the Input class.
  71. /// </summary>
  72. public virtual Vector2 mouseScrollDelta
  73. {
  74. get { return Input.mouseScrollDelta; }
  75. }
  76. /// <summary>
  77. /// Interface to Input.touchSupported. Can be overridden to provide custom input instead of using the Input class.
  78. /// </summary>
  79. public virtual bool touchSupported
  80. {
  81. get { return Input.touchSupported; }
  82. }
  83. /// <summary>
  84. /// Interface to Input.touchCount. Can be overridden to provide custom input instead of using the Input class.
  85. /// </summary>
  86. public virtual int touchCount
  87. {
  88. get { return Input.touchCount; }
  89. }
  90. /// <summary>
  91. /// Interface to Input.GetTouch. Can be overridden to provide custom input instead of using the Input class.
  92. /// </summary>
  93. /// <param name="index">Touch index to get</param>
  94. public virtual Touch GetTouch(int index)
  95. {
  96. return Input.GetTouch(index);
  97. }
  98. /// <summary>
  99. /// Interface to Input.GetAxisRaw. Can be overridden to provide custom input instead of using the Input class.
  100. /// </summary>
  101. /// <param name="axisName">Axis name to check</param>
  102. public virtual float GetAxisRaw(string axisName)
  103. {
  104. return Input.GetAxisRaw(axisName);
  105. }
  106. /// <summary>
  107. /// Interface to Input.GetButtonDown. Can be overridden to provide custom input instead of using the Input class.
  108. /// </summary>
  109. /// <param name="buttonName">Button name to get</param>
  110. public virtual bool GetButtonDown(string buttonName)
  111. {
  112. return Input.GetButtonDown(buttonName);
  113. }
  114. }
  115. }