()
| 40 | |
| 41 | // Private methods |
| 42 | private addHotkeys(): void{ |
| 43 | // Hotkeys are added now |
| 44 | this.hotkeysAdded = true; |
| 45 | |
| 46 | // Add the enter hotkey |
| 47 | this.getGame().addHotkey(new Hotkey("enter", new CallbackCollection(this.pressedEnter.bind(this)))); |
| 48 | |
| 49 | // Add hotkeys for each letter from a to z |
| 50 | for(var i = 97; i <= 122; i++){ |
| 51 | this.getGame().addHotkey(new Hotkey(String.fromCharCode(i), new CallbackCollection(this.pressedKey.bind(this, String.fromCharCode(i))))); |
| 52 | } |
| 53 | |
| 54 | // Same thing for the numbers from 0 to 9 |
| 55 | for(var i = 48; i <= 57; i++){ |
| 56 | this.getGame().addHotkey(new Hotkey(String.fromCharCode(i), new CallbackCollection(this.pressedKey.bind(this, String.fromCharCode(i))))); |
| 57 | this.getGame().addHotkey(new Hotkey("numpad" + String.fromCharCode(i), new CallbackCollection(this.pressedKey.bind(this, String.fromCharCode(i))))); |
| 58 | } |
| 59 | |
| 60 | // Add the hotkey for the space key |
| 61 | this.getGame().addHotkey(new Hotkey("space", new CallbackCollection(this.pressedKey.bind(this, " ")))); |
| 62 | |
| 63 | // Add the hotkey for the delete key |
| 64 | this.getGame().addHotkey(new Hotkey("delete", new CallbackCollection(this.pressedDelete.bind(this)))); |
| 65 | } |
| 66 | |
| 67 | private addLine(line: TheComputerLine): void{ |
| 68 | this.lines.push(line); |
no test coverage detected