No Description
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.

SimpleControls.cs 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
  4. // version 1.8.2
  5. // from Assets/Samples/SimpleDemo/SimpleControls.inputactions
  6. //
  7. // Changes to this file may cause incorrect behavior and will be lost if
  8. // the code is regenerated.
  9. // </auto-generated>
  10. //------------------------------------------------------------------------------
  11. using System;
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using UnityEngine.InputSystem;
  15. using UnityEngine.InputSystem.Utilities;
  16. using UnityEngine;
  17. public partial class @SimpleControls: IInputActionCollection2, IDisposable
  18. {
  19. public InputActionAsset asset { get; }
  20. public @SimpleControls()
  21. {
  22. asset = InputActionAsset.FromJson(@"{
  23. ""name"": ""SimpleControls"",
  24. ""maps"": [
  25. {
  26. ""name"": ""gameplay"",
  27. ""id"": ""265c38f5-dd18-4d34-b198-aec58e1627ff"",
  28. ""actions"": [
  29. {
  30. ""name"": ""fire"",
  31. ""type"": ""Button"",
  32. ""id"": ""1077f913-a9f9-41b1-acb3-b9ee0adbc744"",
  33. ""expectedControlType"": ""Button"",
  34. ""processors"": """",
  35. ""interactions"": ""Tap,SlowTap"",
  36. ""initialStateCheck"": false
  37. },
  38. {
  39. ""name"": ""move"",
  40. ""type"": ""Value"",
  41. ""id"": ""50fd2809-3aa3-4a90-988e-1facf6773553"",
  42. ""expectedControlType"": ""Vector2"",
  43. ""processors"": """",
  44. ""interactions"": """",
  45. ""initialStateCheck"": true
  46. },
  47. {
  48. ""name"": ""look"",
  49. ""type"": ""Value"",
  50. ""id"": ""c60e0974-d140-4597-a40e-9862193067e9"",
  51. ""expectedControlType"": ""Vector2"",
  52. ""processors"": """",
  53. ""interactions"": """",
  54. ""initialStateCheck"": true
  55. }
  56. ],
  57. ""bindings"": [
  58. {
  59. ""name"": """",
  60. ""id"": ""abb776f3-f329-4f7b-bbf8-b577d13be018"",
  61. ""path"": ""*/{PrimaryAction}"",
  62. ""interactions"": """",
  63. ""processors"": """",
  64. ""groups"": """",
  65. ""action"": ""fire"",
  66. ""isComposite"": false,
  67. ""isPartOfComposite"": false
  68. },
  69. {
  70. ""name"": """",
  71. ""id"": ""e1b8c4dd-7b3a-4db6-a93a-0889b59b1afc"",
  72. ""path"": ""<Gamepad>/leftStick"",
  73. ""interactions"": """",
  74. ""processors"": """",
  75. ""groups"": """",
  76. ""action"": ""move"",
  77. ""isComposite"": false,
  78. ""isPartOfComposite"": false
  79. },
  80. {
  81. ""name"": ""Dpad"",
  82. ""id"": ""cefc16fc-557a-44b0-939f-2ad792876b07"",
  83. ""path"": ""Dpad"",
  84. ""interactions"": """",
  85. ""processors"": """",
  86. ""groups"": """",
  87. ""action"": ""move"",
  88. ""isComposite"": true,
  89. ""isPartOfComposite"": false
  90. },
  91. {
  92. ""name"": ""up"",
  93. ""id"": ""07244659-79df-461d-b329-defbe2fbc5f6"",
  94. ""path"": ""<Keyboard>/w"",
  95. ""interactions"": """",
  96. ""processors"": """",
  97. ""groups"": """",
  98. ""action"": ""move"",
  99. ""isComposite"": false,
  100. ""isPartOfComposite"": true
  101. },
  102. {
  103. ""name"": ""down"",
  104. ""id"": ""f0ec75cb-f02c-40d2-a33f-1fd6eab2ae0b"",
  105. ""path"": ""<Keyboard>/s"",
  106. ""interactions"": """",
  107. ""processors"": """",
  108. ""groups"": """",
  109. ""action"": ""move"",
  110. ""isComposite"": false,
  111. ""isPartOfComposite"": true
  112. },
  113. {
  114. ""name"": ""left"",
  115. ""id"": ""21fe6bfe-4721-4483-9f4a-a0031ade105c"",
  116. ""path"": ""<Keyboard>/a"",
  117. ""interactions"": """",
  118. ""processors"": """",
  119. ""groups"": """",
  120. ""action"": ""move"",
  121. ""isComposite"": false,
  122. ""isPartOfComposite"": true
  123. },
  124. {
  125. ""name"": ""right"",
  126. ""id"": ""2dd39746-c75c-4a11-838a-e59eacaf4e0b"",
  127. ""path"": ""<Keyboard>/d"",
  128. ""interactions"": """",
  129. ""processors"": """",
  130. ""groups"": """",
  131. ""action"": ""move"",
  132. ""isComposite"": false,
  133. ""isPartOfComposite"": true
  134. },
  135. {
  136. ""name"": """",
  137. ""id"": ""c106d6e6-2780-47ff-b318-396171bd54cc"",
  138. ""path"": ""<Gamepad>/rightStick"",
  139. ""interactions"": """",
  140. ""processors"": """",
  141. ""groups"": """",
  142. ""action"": ""look"",
  143. ""isComposite"": false,
  144. ""isPartOfComposite"": false
  145. },
  146. {
  147. ""name"": """",
  148. ""id"": ""578caa03-6827-4797-adfc-a59770c437fe"",
  149. ""path"": ""<Pointer>/delta"",
  150. ""interactions"": """",
  151. ""processors"": ""ScaleVector2(x=2,y=2)"",
  152. ""groups"": """",
  153. ""action"": ""look"",
  154. ""isComposite"": false,
  155. ""isPartOfComposite"": false
  156. }
  157. ]
  158. }
  159. ],
  160. ""controlSchemes"": []
  161. }");
  162. // gameplay
  163. m_gameplay = asset.FindActionMap("gameplay", throwIfNotFound: true);
  164. m_gameplay_fire = m_gameplay.FindAction("fire", throwIfNotFound: true);
  165. m_gameplay_move = m_gameplay.FindAction("move", throwIfNotFound: true);
  166. m_gameplay_look = m_gameplay.FindAction("look", throwIfNotFound: true);
  167. }
  168. ~@SimpleControls()
  169. {
  170. Debug.Assert(!m_gameplay.enabled, "This will cause a leak and performance issues, SimpleControls.gameplay.Disable() has not been called.");
  171. }
  172. public void Dispose()
  173. {
  174. UnityEngine.Object.Destroy(asset);
  175. }
  176. public InputBinding? bindingMask
  177. {
  178. get => asset.bindingMask;
  179. set => asset.bindingMask = value;
  180. }
  181. public ReadOnlyArray<InputDevice>? devices
  182. {
  183. get => asset.devices;
  184. set => asset.devices = value;
  185. }
  186. public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
  187. public bool Contains(InputAction action)
  188. {
  189. return asset.Contains(action);
  190. }
  191. public IEnumerator<InputAction> GetEnumerator()
  192. {
  193. return asset.GetEnumerator();
  194. }
  195. IEnumerator IEnumerable.GetEnumerator()
  196. {
  197. return GetEnumerator();
  198. }
  199. public void Enable()
  200. {
  201. asset.Enable();
  202. }
  203. public void Disable()
  204. {
  205. asset.Disable();
  206. }
  207. public IEnumerable<InputBinding> bindings => asset.bindings;
  208. public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
  209. {
  210. return asset.FindAction(actionNameOrId, throwIfNotFound);
  211. }
  212. public int FindBinding(InputBinding bindingMask, out InputAction action)
  213. {
  214. return asset.FindBinding(bindingMask, out action);
  215. }
  216. // gameplay
  217. private readonly InputActionMap m_gameplay;
  218. private List<IGameplayActions> m_GameplayActionsCallbackInterfaces = new List<IGameplayActions>();
  219. private readonly InputAction m_gameplay_fire;
  220. private readonly InputAction m_gameplay_move;
  221. private readonly InputAction m_gameplay_look;
  222. public struct GameplayActions
  223. {
  224. private @SimpleControls m_Wrapper;
  225. public GameplayActions(@SimpleControls wrapper) { m_Wrapper = wrapper; }
  226. public InputAction @fire => m_Wrapper.m_gameplay_fire;
  227. public InputAction @move => m_Wrapper.m_gameplay_move;
  228. public InputAction @look => m_Wrapper.m_gameplay_look;
  229. public InputActionMap Get() { return m_Wrapper.m_gameplay; }
  230. public void Enable() { Get().Enable(); }
  231. public void Disable() { Get().Disable(); }
  232. public bool enabled => Get().enabled;
  233. public static implicit operator InputActionMap(GameplayActions set) { return set.Get(); }
  234. public void AddCallbacks(IGameplayActions instance)
  235. {
  236. if (instance == null || m_Wrapper.m_GameplayActionsCallbackInterfaces.Contains(instance)) return;
  237. m_Wrapper.m_GameplayActionsCallbackInterfaces.Add(instance);
  238. @fire.started += instance.OnFire;
  239. @fire.performed += instance.OnFire;
  240. @fire.canceled += instance.OnFire;
  241. @move.started += instance.OnMove;
  242. @move.performed += instance.OnMove;
  243. @move.canceled += instance.OnMove;
  244. @look.started += instance.OnLook;
  245. @look.performed += instance.OnLook;
  246. @look.canceled += instance.OnLook;
  247. }
  248. private void UnregisterCallbacks(IGameplayActions instance)
  249. {
  250. @fire.started -= instance.OnFire;
  251. @fire.performed -= instance.OnFire;
  252. @fire.canceled -= instance.OnFire;
  253. @move.started -= instance.OnMove;
  254. @move.performed -= instance.OnMove;
  255. @move.canceled -= instance.OnMove;
  256. @look.started -= instance.OnLook;
  257. @look.performed -= instance.OnLook;
  258. @look.canceled -= instance.OnLook;
  259. }
  260. public void RemoveCallbacks(IGameplayActions instance)
  261. {
  262. if (m_Wrapper.m_GameplayActionsCallbackInterfaces.Remove(instance))
  263. UnregisterCallbacks(instance);
  264. }
  265. public void SetCallbacks(IGameplayActions instance)
  266. {
  267. foreach (var item in m_Wrapper.m_GameplayActionsCallbackInterfaces)
  268. UnregisterCallbacks(item);
  269. m_Wrapper.m_GameplayActionsCallbackInterfaces.Clear();
  270. AddCallbacks(instance);
  271. }
  272. }
  273. public GameplayActions @gameplay => new GameplayActions(this);
  274. public interface IGameplayActions
  275. {
  276. void OnFire(InputAction.CallbackContext context);
  277. void OnMove(InputAction.CallbackContext context);
  278. void OnLook(InputAction.CallbackContext context);
  279. }
  280. }