Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 1x 1x 1x 15x 15x 15x 14x 14x 14x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 10x 10x 4x 6x 12x 6x 6x 6x 6x 4x 2x 1x | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InputTypeKeyboard = void 0;
const inputType_1 = require("./inputType");
class InputTypeKeyboard extends inputType_1.InputType {
constructor() {
super();
this.onKeyboardEventUp = this.onKeyboardEventUp.bind(this);
this.onKeyboardEventDown = this.onKeyboardEventDown.bind(this);
}
initialize(engineCore, inputReceiver) {
super.initialize(engineCore, inputReceiver);
this.inputReceiver.addEventListener("keyup", this.onKeyboardEventUp);
this.inputReceiver.addEventListener("keydown", this.onKeyboardEventDown);
}
destroy() {
this.inputReceiver.removeEventListener("keyup", this.onKeyboardEventUp);
this.inputReceiver.removeEventListener("keydown", this.onKeyboardEventDown);
}
onKeyboardEventDown(event) {
const eventKey = event;
const scenes = this.engineCore.children;
const action = (inputEntity) => inputEntity.keyDown(eventKey);
this.updateScenes(scenes, action);
}
onKeyboardEventUp(event) {
const eventKey = event;
const scenes = this.engineCore.children;
const action = (inputEntity) => inputEntity.keyUp(eventKey);
this.updateScenes(scenes, action);
}
updateScenes(scenes, action) {
for (const scene of scenes) {
if (!scene.isVisible || !scene.isEnabled)
continue;
this.updateEntities(scene.children, action);
}
}
updateEntities(entities, action) {
var _a;
for (const entity of entities) {
const inputEntity = entity;
const receivePointerInput = (_a = inputEntity.receiveKeyboardInput) !== null && _a !== void 0 ? _a : false;
this.updateEntities(entity.children, action);
if (!receivePointerInput)
continue;
action(inputEntity);
}
}
}
exports.InputTypeKeyboard = InputTypeKeyboard;
|