1515using UnityEngine . InputSystem ;
1616using UnityEngine . InputSystem . Utilities ;
1717
18- /// <summary>
19- /// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions".
20- /// </summary>
21- /// <remarks>
22- /// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
23- /// </remarks>
24- /// <example>
25- /// <code>
26- /// using namespace UnityEngine;
27- /// using UnityEngine.InputSystem;
28- ///
29- /// // Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface.
30- /// public class Example : MonoBehaviour, MyActions.IPlayerActions
31- /// {
32- /// private MyActions_Actions m_Actions; // Source code representation of asset.
33- /// private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map.
34- ///
35- /// void Awake()
36- /// {
37- /// m_Actions = new MyActions_Actions(); // Create asset object.
38- /// m_Player = m_Actions.Player; // Extract action map object.
39- /// m_Player.AddCallbacks(this); // Register callback interface IPlayerActions.
40- /// }
41- ///
42- /// void OnDestroy()
43- /// {
44- /// m_Actions.Dispose(); // Destroy asset object.
45- /// }
46- ///
47- /// void OnEnable()
48- /// {
49- /// m_Player.Enable(); // Enable all actions within map.
50- /// }
51- ///
52- /// void OnDisable()
53- /// {
54- /// m_Player.Disable(); // Disable all actions within map.
55- /// }
56- ///
57- /// #region Interface implementation of MyActions.IPlayerActions
58- ///
59- /// // Invoked when "Move" action is either started, performed or canceled.
60- /// public void OnMove(InputAction.CallbackContext context)
61- /// {
62- /// Debug.Log($"OnMove: {context.ReadValue<Vector2>()}");
63- /// }
64- ///
65- /// // Invoked when "Attack" action is either started, performed or canceled.
66- /// public void OnAttack(InputAction.CallbackContext context)
67- /// {
68- /// Debug.Log($"OnAttack: {context.ReadValue<float>()}");
69- /// }
70- ///
71- /// #endregion
72- /// }
73- /// </code>
74- /// </example>
7518public partial class @InputActionCodeGeneratorActions : IInputActionCollection2 , IDisposable
7619{
77- /// <summary>
78- /// Provides access to the underlying asset instance.
79- /// </summary>
8020 public InputActionAsset asset { get ; }
81-
82- /// <summary>
83- /// Constructs a new instance.
84- /// </summary>
8521 public @InputActionCodeGeneratorActions ( )
8622 {
8723 asset = InputActionAsset . FromJson ( @"{
@@ -149,71 +85,57 @@ public @InputActionCodeGeneratorActions()
14985 UnityEngine . Debug . Assert ( ! m_gameplay . enabled , "This will cause a leak and performance issues, InputActionCodeGeneratorActions.gameplay.Disable() has not been called." ) ;
15086 }
15187
152- /// <summary>
153- /// Destroys this asset and all associated <see cref="InputAction"/> instances.
154- /// </summary>
15588 public void Dispose ( )
15689 {
15790 UnityEngine . Object . Destroy ( asset ) ;
15891 }
15992
160- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindingMask" />
16193 public InputBinding ? bindingMask
16294 {
16395 get => asset . bindingMask ;
16496 set => asset . bindingMask = value ;
16597 }
16698
167- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.devices" />
16899 public ReadOnlyArray < InputDevice > ? devices
169100 {
170101 get => asset . devices ;
171102 set => asset . devices = value ;
172103 }
173104
174- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.controlSchemes" />
175105 public ReadOnlyArray < InputControlScheme > controlSchemes => asset . controlSchemes ;
176106
177- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Contains(InputAction)" />
178107 public bool Contains ( InputAction action )
179108 {
180109 return asset . Contains ( action ) ;
181110 }
182111
183- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.GetEnumerator()" />
184112 public IEnumerator < InputAction > GetEnumerator ( )
185113 {
186114 return asset . GetEnumerator ( ) ;
187115 }
188116
189- /// <inheritdoc cref="IEnumerable.GetEnumerator()" />
190117 IEnumerator IEnumerable . GetEnumerator ( )
191118 {
192119 return GetEnumerator ( ) ;
193120 }
194121
195- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Enable()" />
196122 public void Enable ( )
197123 {
198124 asset . Enable ( ) ;
199125 }
200126
201- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Disable()" />
202127 public void Disable ( )
203128 {
204129 asset . Disable ( ) ;
205130 }
206131
207- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindings" />
208132 public IEnumerable < InputBinding > bindings => asset . bindings ;
209133
210- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindAction(string, bool)" />
211134 public InputAction FindAction ( string actionNameOrId , bool throwIfNotFound = false )
212135 {
213136 return asset . FindAction ( actionNameOrId , throwIfNotFound ) ;
214137 }
215138
216- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindBinding(InputBinding, out InputAction)" />
217139 public int FindBinding ( InputBinding bindingMask , out InputAction action )
218140 {
219141 return asset . FindBinding ( bindingMask , out action ) ;
@@ -224,47 +146,17 @@ public int FindBinding(InputBinding bindingMask, out InputAction action)
224146 private List < IGameplayActions > m_GameplayActionsCallbackInterfaces = new List < IGameplayActions > ( ) ;
225147 private readonly InputAction m_gameplay_action1 ;
226148 private readonly InputAction m_gameplay_action2 ;
227- /// <summary>
228- /// Provides access to input actions defined in input action map "gameplay".
229- /// </summary>
230149 public struct GameplayActions
231150 {
232151 private @InputActionCodeGeneratorActions m_Wrapper ;
233-
234- /// <summary>
235- /// Construct a new instance of the input action map wrapper class.
236- /// </summary>
237152 public GameplayActions ( @InputActionCodeGeneratorActions wrapper ) { m_Wrapper = wrapper ; }
238- /// <summary>
239- /// Provides access to the underlying input action "gameplay/action1".
240- /// </summary>
241153 public InputAction @action1 => m_Wrapper . m_gameplay_action1 ;
242- /// <summary>
243- /// Provides access to the underlying input action "gameplay/action2".
244- /// </summary>
245154 public InputAction @action2 => m_Wrapper . m_gameplay_action2 ;
246- /// <summary>
247- /// Provides access to the underlying input action map instance.
248- /// </summary>
249155 public InputActionMap Get ( ) { return m_Wrapper . m_gameplay ; }
250- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
251156 public void Enable ( ) { Get ( ) . Enable ( ) ; }
252- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
253157 public void Disable ( ) { Get ( ) . Disable ( ) ; }
254- /// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
255158 public bool enabled => Get ( ) . enabled ;
256- /// <summary>
257- /// Implicitly converts an <see ref="GameplayActions" /> to an <see ref="InputActionMap" /> instance.
258- /// </summary>
259159 public static implicit operator InputActionMap ( GameplayActions set ) { return set . Get ( ) ; }
260- /// <summary>
261- /// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
262- /// </summary>
263- /// <param name="instance">Callback instance.</param>
264- /// <remarks>
265- /// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
266- /// </remarks>
267- /// <seealso cref="GameplayActions" />
268160 public void AddCallbacks ( IGameplayActions instance )
269161 {
270162 if ( instance == null || m_Wrapper . m_GameplayActionsCallbackInterfaces . Contains ( instance ) ) return ;
@@ -277,13 +169,6 @@ public void AddCallbacks(IGameplayActions instance)
277169 @action2 . canceled += instance . OnAction2 ;
278170 }
279171
280- /// <summary>
281- /// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
282- /// </summary>
283- /// <remarks>
284- /// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
285- /// </remarks>
286- /// <seealso cref="GameplayActions" />
287172 private void UnregisterCallbacks ( IGameplayActions instance )
288173 {
289174 @action1 . started -= instance . OnAction1 ;
@@ -294,25 +179,12 @@ private void UnregisterCallbacks(IGameplayActions instance)
294179 @action2 . canceled -= instance . OnAction2 ;
295180 }
296181
297- /// <summary>
298- /// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />.
299- /// </summary>
300- /// <seealso cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />
301182 public void RemoveCallbacks ( IGameplayActions instance )
302183 {
303184 if ( m_Wrapper . m_GameplayActionsCallbackInterfaces . Remove ( instance ) )
304185 UnregisterCallbacks ( instance ) ;
305186 }
306187
307- /// <summary>
308- /// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
309- /// </summary>
310- /// <remarks>
311- /// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
312- /// </remarks>
313- /// <seealso cref="GameplayActions.AddCallbacks(IGameplayActions)" />
314- /// <seealso cref="GameplayActions.RemoveCallbacks(IGameplayActions)" />
315- /// <seealso cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />
316188 public void SetCallbacks ( IGameplayActions instance )
317189 {
318190 foreach ( var item in m_Wrapper . m_GameplayActionsCallbackInterfaces )
@@ -321,30 +193,10 @@ public void SetCallbacks(IGameplayActions instance)
321193 AddCallbacks ( instance ) ;
322194 }
323195 }
324- /// <summary>
325- /// Provides a new <see cref="GameplayActions" /> instance referencing this action map.
326- /// </summary>
327196 public GameplayActions @gameplay => new GameplayActions ( this ) ;
328- /// <summary>
329- /// Interface to implement callback methods for all input action callbacks associated with input actions defined by "gameplay" which allows adding and removing callbacks.
330- /// </summary>
331- /// <seealso cref="GameplayActions.AddCallbacks(IGameplayActions)" />
332- /// <seealso cref="GameplayActions.RemoveCallbacks(IGameplayActions)" />
333197 public interface IGameplayActions
334198 {
335- /// <summary>
336- /// Method invoked when associated input action "action1" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
337- /// </summary>
338- /// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
339- /// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
340- /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
341199 void OnAction1 ( InputAction . CallbackContext context ) ;
342- /// <summary>
343- /// Method invoked when associated input action "action2" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
344- /// </summary>
345- /// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
346- /// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
347- /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
348200 void OnAction2 ( InputAction . CallbackContext context ) ;
349201 }
350202}
0 commit comments