ViewInput beta
Interface of @v12-engine/client
export interface ViewInputWhat the player does, as the game's view takes it (GameView.input): the keys and the actions on them, how units are selected and what follows a selection, what a press of a button, a key and a right click do, the commands before they are sent, the keys locked, the cursor, and how a building is put down
Members
beforeSend
beforeSend?: (command: PlayerCommand, client: GameClientApi) => PlayerCommand | PlayerCommand[] | null | undefined;Every command the player's hands send, before it goes: the same, another, several, or null for none. A tutorial that allows only what it teaches, a confirmation, orders that fan out
cursor
cursor?: (mode: Mode, hovered: EntityView | undefined) => string | undefined;The pointer over the view, as a CSS cursor ('crosshair', 'url(sword.png) 4 4, auto'), from what a click is about to do and what the pointer is over. The client's when nothing
keys
keys?: KeySettings;The keys: those of a hero's abilities and spells and of the shop, and what the game says of the actions the keys and the pointer's buttons do (keys.actions: its own, the client's it leaves out or changes). In code: client.keys
lockKeys
lockKeys?: boolean;Whether, in full screen, the keys the game uses are asked of the browser (Esc, the F keys, Ctrl with a digit), so that they are the game's and not the browser's. Yes when left out. In code: client.keyboardLock.enabled
onKey
onKey?: (event: KeyboardEvent, client: GameClientApi) => boolean | void;A key pressed, before any key of the client's does anything. True when it is the game's: the client then does nothing with it. A key the player can put elsewhere is an action (keys.actions), not this
onPress
onPress?: (button: CommandButton, context: PressContext) => boolean | void;Steps in when a button of the card is pressed, by mouse or key, before it does anything: a tutorial that waits for one button, a confirmation. True when it is the game's to handle: the button then does nothing of its own
onRightClick
onRightClick?: (click: ClickContext) => boolean | void | {
ping: PingMode | null;
};A right-click on the map with something selected, before the smart order goes. True when it is the game's to handle; { ping } lets the smart order go, marked as the game says (null for no mark)
placement
placement?: PlacementLook;What is shown where a building is about to be put down: the client's (the building's own model, see-through, in the colour of whether it fits, over its cells) in the look given here (PlacementLook)
selection
selection?: SelectionRules;How the player selects: what a box takes, what a double-click adds, the order, which one the card is about, how many at most
selectionChanged
selectionChanged?: (ids: readonly number[], client: GameClientApi) => void;Told whenever what is selected changes