A game about forced loneliness, made by TACStudios
at master 137 lines 5.1 kB view raw
1using UnityEngine.UI; 2 3namespace UnityEngine.EventSystems 4{ 5 /// <summary> 6 /// 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. 7 /// </summary> 8 public class BaseInput : UIBehaviour 9 { 10 /// <summary> 11 /// Interface to Input.compositionString. Can be overridden to provide custom input instead of using the Input class. 12 /// </summary> 13 public virtual string compositionString 14 { 15 get { return Input.compositionString; } 16 } 17 18 /// <summary> 19 /// Interface to Input.imeCompositionMode. Can be overridden to provide custom input instead of using the Input class. 20 /// </summary> 21 public virtual IMECompositionMode imeCompositionMode 22 { 23 get { return Input.imeCompositionMode; } 24 set { Input.imeCompositionMode = value; } 25 } 26 27 /// <summary> 28 /// Interface to Input.compositionCursorPos. Can be overridden to provide custom input instead of using the Input class. 29 /// </summary> 30 public virtual Vector2 compositionCursorPos 31 { 32 get { return Input.compositionCursorPos; } 33 set { Input.compositionCursorPos = value; } 34 } 35 36 /// <summary> 37 /// Interface to Input.mousePresent. Can be overridden to provide custom input instead of using the Input class. 38 /// </summary> 39 public virtual bool mousePresent 40 { 41 get { return Input.mousePresent; } 42 } 43 44 /// <summary> 45 /// Interface to Input.GetMouseButtonDown. Can be overridden to provide custom input instead of using the Input class. 46 /// </summary> 47 /// <param name="button"></param> 48 /// <returns></returns> 49 public virtual bool GetMouseButtonDown(int button) 50 { 51 return Input.GetMouseButtonDown(button); 52 } 53 54 /// <summary> 55 /// Interface to Input.GetMouseButtonUp. Can be overridden to provide custom input instead of using the Input class. 56 /// </summary> 57 public virtual bool GetMouseButtonUp(int button) 58 { 59 return Input.GetMouseButtonUp(button); 60 } 61 62 /// <summary> 63 /// Interface to Input.GetMouseButton. Can be overridden to provide custom input instead of using the Input class. 64 /// </summary> 65 public virtual bool GetMouseButton(int button) 66 { 67 return Input.GetMouseButton(button); 68 } 69 70 /// <summary> 71 /// Interface to Input.mousePosition. Can be overridden to provide custom input instead of using the Input class. 72 /// </summary> 73 public virtual Vector2 mousePosition 74 { 75 get { return Input.mousePosition; } 76 } 77 78 /// <summary> 79 /// Interface to Input.mouseScrollDelta. Can be overridden to provide custom input instead of using the Input class. 80 /// </summary> 81 public virtual Vector2 mouseScrollDelta 82 { 83 get { return Input.mouseScrollDelta; } 84 } 85 86 /// <summary> 87 /// The magnitude of mouseScrollDelta that corresponds to exactly one tick of the scroll wheel. 88 /// </summary> 89 public virtual float mouseScrollDeltaPerTick 90 { 91 get { return 1.0f; } 92 } 93 94 /// <summary> 95 /// Interface to Input.touchSupported. Can be overridden to provide custom input instead of using the Input class. 96 /// </summary> 97 public virtual bool touchSupported 98 { 99 get { return Input.touchSupported; } 100 } 101 102 /// <summary> 103 /// Interface to Input.touchCount. Can be overridden to provide custom input instead of using the Input class. 104 /// </summary> 105 public virtual int touchCount 106 { 107 get { return Input.touchCount; } 108 } 109 110 /// <summary> 111 /// Interface to Input.GetTouch. Can be overridden to provide custom input instead of using the Input class. 112 /// </summary> 113 /// <param name="index">Touch index to get</param> 114 public virtual Touch GetTouch(int index) 115 { 116 return Input.GetTouch(index); 117 } 118 119 /// <summary> 120 /// Interface to Input.GetAxisRaw. Can be overridden to provide custom input instead of using the Input class. 121 /// </summary> 122 /// <param name="axisName">Axis name to check</param> 123 public virtual float GetAxisRaw(string axisName) 124 { 125 return Input.GetAxisRaw(axisName); 126 } 127 128 /// <summary> 129 /// Interface to Input.GetButtonDown. Can be overridden to provide custom input instead of using the Input class. 130 /// </summary> 131 /// <param name="buttonName">Button name to get</param> 132 public virtual bool GetButtonDown(string buttonName) 133 { 134 return Input.GetButtonDown(buttonName); 135 } 136 } 137}