Files
2026-05-06 08:17:32 +08:00

28 lines
1.2 KiB
TypeScript

/**
* Event constants emitted by the floating control layer and consumed by the
* gameplay layer. Centralising them avoids typo-driven wiring bugs and gives
* Jest a place to assert against expected strings.
*/
export const InputEvents = {
/** payload: `{ dx: number; dy: number; klass: JoystickAngleClass }` */
JoystickMove: 'input/joystickMove',
/** payload: `{}` — jump button went down (req 2.2). */
JumpPressed: 'input/jumpPressed',
/** payload: `{ holdMs: number }` — jump button released. */
JumpReleased: 'input/jumpReleased',
/** payload: `{}` — shuriken button down. */
ShurikenPressed: 'input/shurikenPressed',
ShurikenReleased: 'input/shurikenReleased',
/** payload: `{}` — ninja sword button down. */
NinjaSwordPressed: 'input/ninjaSwordPressed',
NinjaSwordReleased: 'input/ninjaSwordReleased',
/**
* payload: `{ id: 'jump' | 'shuriken' | 'ninja_sword'; disabled: boolean; reason?: string }`
* — button must repaint (e.g. airborne → jump disabled, req 2.4).
*/
ButtonVisualChanged: 'input/buttonVisualChanged',
} as const;
export type InputEventName = (typeof InputEvents)[keyof typeof InputEvents];