()
| 402 | } |
| 403 | |
| 404 | private update(): void{ |
| 405 | // Erase everything |
| 406 | this.renderArea.resetAllButSize(); |
| 407 | |
| 408 | // Back to the map button |
| 409 | this.addBackToMainMapButton(this.renderArea, "aTreeBackToTheMapButton"); |
| 410 | |
| 411 | // Draw the tree with the squirrel |
| 412 | this.renderArea.drawArray(Database.getAscii("places/aTree/background"), 0, 3); |
| 413 | |
| 414 | // Draw the speech |
| 415 | switch(Saving.loadNumber("aTreeStep")){ |
| 416 | // Introduction speech |
| 417 | case 0: |
| 418 | this.drawSpeech(Database.getText("mapATreeIntroductionSpeech"), Database.getTranslatedText("mapATreeIntroductionSpeech")); |
| 419 | this.renderArea.addAsciiRealButton(Database.getText("mapATreeIntroductionButton"), 21, 24, "aTreeIntroductionButton", Database.getTranslatedText("mapATreeIntroductionButton")); |
| 420 | this.renderArea.addLinkCall(".aTreeIntroductionButton", new CallbackCollection(this.nextStep.bind(this))); |
| 421 | break; |
| 422 | // First question (do you like candies) |
| 423 | case 1: |
| 424 | this.drawSpeech(Database.getText("mapATreeFirstQuestion"), Database.getTranslatedText("mapATreeFirstQuestion")); |
| 425 | this.addEnigma(new EnigmaAnswerStrings(["yes", "y", "yeah", "yeap", "yep"]), new CallbackCollection(this.nextStep.bind(this), this.reward1.bind(this)), "aTreeFirstQuestionEnigma", "aTreeFirstQuestionWrong"); |
| 426 | break; |
| 427 | // Second question (S E I D N A ?) |
| 428 | case 2: |
| 429 | this.drawSpeech(Database.getText("mapATreeSecondQuestion"), Database.getTranslatedText("mapATreeSecondQuestion")); |
| 430 | this.addEnigma(new EnigmaAnswerStrings(["c", "letterc", "theletterc"]), new CallbackCollection(this.nextStep.bind(this), this.reward2.bind(this)), "aTreeSecondQuestionEnigma", "aTreeSecondQuestionWrong"); |
| 431 | break; |
| 432 | // Third question (how many candies does the candiest man in the world possess?) |
| 433 | case 3: |
| 434 | this.drawSpeech(Database.getText("mapATreeThirdQuestion"), Database.getTranslatedText("mapATreeThirdQuestion")); |
| 435 | this.addEnigma(new EnigmaAnswerCandies(this.getGame()), new CallbackCollection(this.nextStep.bind(this), this.reward3.bind(this)), "aTreeThirdQuestionEnigma", "aTreeThirdQuestionWrong"); |
| 436 | break; |
| 437 | // Fourth question (number of marks on the tree) |
| 438 | case 4: |
| 439 | this.drawSpeech(Database.getText("mapATreeFourthQuestion"), Database.getTranslatedText("mapATreeFourthQuestion"), 75); |
| 440 | this.addEnigma(new EnigmaAnswerStrings(["10", "ten", "10marks", "tenmarks"]), new CallbackCollection(this.nextStep.bind(this), this.reward4.bind(this)), "aTreeFourthQuestionEnigma", "aTreeFourthQuestionWrong"); |
| 441 | break; |
| 442 | // Fifth question (yellow hat in the red sea) |
| 443 | case 5: |
| 444 | this.drawSpeech(Database.getText("mapATreeFifthQuestion"), Database.getTranslatedText("mapATreeFifthQuestion"), 75); |
| 445 | this.addEnigma(new EnigmaAnswerStrings(["wet", "itbecomeswet", "itbecomewet", "becomeswet", "becomewet", "itgetswet", "itgetwet", "itswet", "itgotwet", "itiswet", "itiswetnow", "itswetnow", "float", "floats", "itfloats", "itsfloating", "itisfloating", "floating", "itfloat"]), new CallbackCollection(this.nextStep.bind(this), this.reward5.bind(this)), "aTreeFifthQuestionEnigma", "aTreeFifthQuestionWrong"); |
| 446 | break; |
| 447 | // Sixth question (tic-tac-toe) : intro speech |
| 448 | case 6: |
| 449 | // Draw the speech |
| 450 | this.drawSpeech(Database.getText("mapATreeTicTacToeIntro"), Database.getTranslatedText("mapATreeTicTacToeIntro"), 75); |
| 451 | // Add the button to go to the next step |
| 452 | this.renderArea.addAsciiRealButton(Database.getText("mapATreeTicTacToeIntroButton"), 21, 24, "mapATreeTicTacToeIntroButton", Database.getTranslatedText("mapATreeTicTacToeIntroButton")); |
| 453 | this.renderArea.addLinkCall(".mapATreeTicTacToeIntroButton", new CallbackCollection(this.nextStep.bind(this))); |
| 454 | break; |
| 455 | case 7: // Tic-tac-toe : let's play! |
| 456 | // Draw different things depending on the tic-tac-toa step |
| 457 | switch(this.ticTacToeStep){ |
| 458 | case ATreeTicTacToeStep.PLAYING: |
| 459 | this.drawSpeech(Database.getText("mapATreeTicTacToeLetsPlay"), Database.getTranslatedText("mapATreeTicTacToeLetsPlay"), 75); // Speech |
| 460 | this.drawTicTacToeBoard(); // Board |
| 461 | break; |
no test coverage detected