()
| 40 | |
| 41 | // Public methods |
| 42 | public update(): void{ |
| 43 | // Erase everything |
| 44 | this.renderArea.resetAllButSize(); |
| 45 | |
| 46 | // Back to the map button |
| 47 | this.addBackToMainMapButton(this.renderArea, "lighthouseBackToTheMapButton"); |
| 48 | |
| 49 | // Draw the lighthouse |
| 50 | this.renderArea.drawArray(Database.getAscii("places/lighthouse/lighthouse"), 0, 3); |
| 51 | |
| 52 | // Add the questions list |
| 53 | this.renderArea.addList(1, 55, 7, "lighthouseQuestionsList", new CallbackCollection(this.questionSelected.bind(this)), this.questionsArray); |
| 54 | |
| 55 | // Add the ask button and the link |
| 56 | this.renderArea.addAsciiRealButton(Database.getText("lighthouseAskButton"), 5, 10, "lighthouseAskButton", Database.getTranslatedText("lighthouseAskButton")); |
| 57 | this.renderArea.addLinkCall(".lighthouseAskButton", new CallbackCollection(this.ask.bind(this))); |
| 58 | |
| 59 | // Draw the speech if there's a speech id |
| 60 | if(this.speechId != null){ |
| 61 | this.renderArea.drawSpeech(Database.getText(this.speechId), 17, 75, 99, "lighthouseSpeech", Database.getTranslatedText(this.speechId)); |
| 62 | } |
| 63 | |
| 64 | // If we should show the puzzle |
| 65 | if(this.showPuzzle){ |
| 66 | // Create the puzzle if it's not done yet |
| 67 | if(this.puzzle == null) |
| 68 | this.puzzle = new LighthousePuzzle(this); |
| 69 | // Draw it |
| 70 | this.puzzle.draw(this.renderArea, new Pos(2, 12)); |
| 71 | // Add the reset button |
| 72 | this.renderArea.addAsciiRealButton(Database.getText("lighthousePuzzleResetButton"), 2, 34, "lighthousePuzzleResetButton", Database.getTranslatedText("lighthousePuzzleResetButton")); |
| 73 | this.renderArea.addLinkCall(".lighthousePuzzleResetButton", new CallbackCollection(this.resetPuzzle.bind(this))); |
| 74 | } |
| 75 | |
| 76 | // Add the link which will call the selectRightQuestion method after the html dom is created |
| 77 | this.renderArea.addLinkCallbackCollection(new CallbackCollection(this.selectRightQuestion.bind(this))); |
| 78 | } |
| 79 | |
| 80 | // Public getters |
| 81 | public getPuzzle(): LighthousePuzzle{ |
no test coverage detected