(renderArea: RenderArea, pos: Pos)
| 31 | } |
| 32 | |
| 33 | public draw(renderArea: RenderArea, pos: Pos): void{ |
| 34 | // If the part is shown already |
| 35 | if(this.shown){ |
| 36 | // Draw something different depending on the type |
| 37 | switch(this.type){ |
| 38 | case LighthousePuzzlePartType.BLANK: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/blankPart"), pos.x, pos.y); break; |
| 39 | case LighthousePuzzlePartType.SHOW_AROUND: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/showAroundPart"), pos.x, pos.y); break; |
| 40 | case LighthousePuzzlePartType.SHOW_LEFT: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/showLeft"), pos.x, pos.y); break; |
| 41 | case LighthousePuzzlePartType.SHOW_BELOW: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/showBelow"), pos.x, pos.y); break; |
| 42 | case LighthousePuzzlePartType.SHOW_ABOVE: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/showAbove"), pos.x, pos.y); break; |
| 43 | case LighthousePuzzlePartType.SHOW_RIGHT: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/showRight"), pos.x, pos.y); break; |
| 44 | case LighthousePuzzlePartType.SHOW_LEFT_RIGHT: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/showLeftRight"), pos.x, pos.y); break; |
| 45 | case LighthousePuzzlePartType.MOVE_BELOW_LINE_TO_THE_RIGHT: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/moveBelowLineToTheRight"), pos.x, pos.y); break; |
| 46 | case LighthousePuzzlePartType.MOVE_LEFT_LINE_ABOVE: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/moveLeftLineAbove"), pos.x, pos.y); break; |
| 47 | case LighthousePuzzlePartType.LIVES: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/livesPart"), pos.x, pos.y); break; |
| 48 | case LighthousePuzzlePartType.WHAT: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/whatPart"), pos.x, pos.y); break; |
| 49 | case LighthousePuzzlePartType.NOTHING_HERE: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/nothingHerePart"), pos.x, pos.y); break; |
| 50 | case LighthousePuzzlePartType.STONE: renderArea.drawArray(Database.getAscii("places/lighthouse/puzzle/stonePart"), pos.x, pos.y); break; |
| 51 | } |
| 52 | |
| 53 | // Draw the lives, depending on the type |
| 54 | switch(this.type){ |
| 55 | // By default, we draw the lives |
| 56 | default: |
| 57 | renderArea.drawHorizontalLine("#", pos.x + 1, pos.x + 1 + this.lives, pos.y + 1); |
| 58 | break; |
| 59 | } |
| 60 | |
| 61 | // Add a button if we have enough lives |
| 62 | if(this.lives > 0){ |
| 63 | // Buttons |
| 64 | for(var i = 0; i < 4; i++){ |
| 65 | renderArea.addAsciiButton(pos.x + 1, pos.x + 6, pos.y + 1 + i, "lighthousePuzzlePart" + pos.x.toString() + "_" + pos.y.toString()); |
| 66 | } |
| 67 | // The link |
| 68 | renderArea.addLinkCall(".lighthousePuzzlePart" + pos.x.toString() + "_" + pos.y.toString(), new CallbackCollection(this.clicked.bind(this))); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // Public getters |
| 74 | public getLives(): number{ |
nothing calls this directly
no test coverage detected