Basic FunctionalityInput ManagementInputManagerOn this pageInputManager Description: InputManager is a class for managing input contexts and actions. Input events can be listened for and handled by creating input contexts and actions, and then adding them to the input manager. Specific combinations of input contexts can be activated and deactivated by calling the pushContext and popContext methods. When an event is triggered, input events can be handled by registering global input event listeners. Class Object: InputManager Class. Usage: local InputManager = require("InputManager")local inputManager = InputManager.CreateManager({ context1 = { action1 = Trigger.KeyDown("W"), },})-- activate context1inputManager:pushContext("context1")-- add prefix "Input." to the listened action namenode:gslot("Input.action1", function() print("action1 triggered")end)-- remove context1 from the context stackinputManager:popContext()inputManager:destroy() getNode Type: Function. Description: Gets the current input node. The input node is used to receive input events. It will be added to Director.entry automatically. Signature: getNode: function(self: InputManager): Node.Type Returns: Return TypeDescriptionNodeThe input node. pushContext Type: Function. Description: Adds an input context to the context stack. Temporarily disables the previous context, then activates the actions in the new context. Signature: pushContext: function(self: InputManager, contextNames: string | {string}): boolean Parameters: ParameterTypeDescriptioncontextNamesstring{string} Returns: Return TypeDescriptionbooleanWhether the context is successfully pushed. popContext Type: Function. Description: Removes the current input context from the context stack. Activates the previous context. Signature: popContext: function(self: InputManager, count?: number): boolean Parameters: ParameterTypeDescriptioncountnumber[optional] The number of contexts to be popped. Default is 1. Returns: Return TypeDescriptionbooleanWhether the context is successfully popped. emitKeyDown Type: Function. Description: Emits a key down event for input simulation. Signature: emitKeyDown: function(self: InputManager, keyName: KeyName) Parameters: ParameterTypeDescriptionkeyNameKeyNameThe name of the key. emitKeyUp Type: Function. Description: Emits a key up event for input simulation. Signature: emitKeyUp: function(self: InputManager, keyName: KeyName) Parameters: ParameterTypeDescriptionkeyNameKeyNameThe name of the key. emitButtonDown Type: Function. Description: Emits a button down event for input simulation. Signature: emitButtonDown: function(self: InputManager, buttonName: ButtonName, controllerId?: number) Parameters: ParameterTypeDescriptionbuttonNameButtonNameThe name of the button.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. emitButtonUp Type: Function. Description: Emits a button up event for input simulation. Signature: emitButtonUp: function(self: InputManager, buttonName: ButtonName, controllerId?: number) Parameters: ParameterTypeDescriptionbuttonNameButtonNameThe name of the button.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. emitAxis Type: Function. Description: Emits an axis event for input simulation. Signature: emitAxis: function(self: InputManager, axisName: AxisName, value: number, controllerId?: number) Parameters: ParameterTypeDescriptionaxisNameAxisNameThe name of the axis.valuenumberThe value of the axis, ranging from -1 to 1.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. destroy Type: Function. Description: Destroys the input manager and clears input event listeners. Signature: destroy: function(self: InputManager)