Cocos AIR native input and the action layer triggers
Source annotations refer to the AIR checkout.
When to use what
- "React to a touch, key or mouse directly" ->
input.on(Input.EventType.X, handler)for the unified feed andsystemEvent.on(SystemEvent.EventType.X, handler)for the raw feed (src/cocos/input/input.ts:160,src/cocos/input/system-event.ts:72); the event classes areEventTouch/EventKeyboard/EventMouse, keys come fromKeyCode. - "Map held keys/pointers to named game actions" ->
createActionState(pure reducer) pluscreateActionInput(one backend); query withheld/pressed/released/axisand drain edges withconsumeTick(src/air/action-state.ts:124-172). - "Gate a paused or backgrounded app" ->
createSessionGateand itsactive/generation; pass it as the adapter'ssession(src/air/action-input.ts:69-100). - "Persistent-page push/pop with preserved state" ->
SceneStackover one long-livedScene(src/air/scene-stack.ts:47-188); useapp.run()replacement instead for a full scene swap (owned by the application skill).