(x: number, y: number, firstTimeWeUpdate: boolean, keepInputContent: boolean)
| 121 | } |
| 122 | |
| 123 | private drawActions(x: number, y: number, firstTimeWeUpdate: boolean, keepInputContent: boolean): void{ |
| 124 | // Variables |
| 125 | var candiesInputHasFocus: boolean = false; |
| 126 | var lollipopsInputHasFocus: boolean = false; |
| 127 | |
| 128 | // If it's not the first time we update, we need to keep some stuff from the page (content of the inputs + focus on the inputs) |
| 129 | if(firstTimeWeUpdate == false){ |
| 130 | // If if the candies / lollipops input has the focus (in order to restore the focus after the page updating) |
| 131 | candiesInputHasFocus = $(".cauldronCandiesInput").is(":focus"); |
| 132 | lollipopsInputHasFocus = $(".cauldronLollipopsInput").is(":focus"); |
| 133 | |
| 134 | // Reset the content of candiesInput and lollipopsInput |
| 135 | this.candiesInput = ""; |
| 136 | this.lollipopsInput = ""; |
| 137 | } |
| 138 | |
| 139 | // What you want to put in the cauldron |
| 140 | // Text |
| 141 | this.renderArea.drawString(Database.getText("cauldronWhatYouWantToPut"), x, y); // Normal |
| 142 | this.renderArea.addBold(x, x + Database.getText("cauldronWhatYouWantToPut").length, y); // Add bold on normal |
| 143 | this.renderArea.drawString(Database.getTranslatedText("cauldronWhatYouWantToPut"), x, y+1, true); // Translated |
| 144 | // Candies input |
| 145 | this.renderArea.addSimpleInput(x, x + 20, y+2, new CallbackCollection(this.changeCandiesInput.bind(this)), "cauldronCandiesInput", (keepInputContent? this.candiesInput: ""), candiesInputHasFocus); |
| 146 | this.renderArea.drawString("candies", x + 21, y+2); |
| 147 | if(this.candiesInputComment != null){ |
| 148 | this.renderArea.drawString(this.candiesInputComment, x + 29, y+2); |
| 149 | this.renderArea.addBold(x + 29, x + 29 + this.candiesInputComment.length, y+2); |
| 150 | } |
| 151 | // Lollipops input |
| 152 | this.renderArea.addSimpleInput(x, x + 20, y+4, new CallbackCollection(this.changeLollipopsInput.bind(this)), "cauldronLollipopsInput", (keepInputContent? this.lollipopsInput: ""), lollipopsInputHasFocus); |
| 153 | this.renderArea.drawString("lollipops", x + 21, y+4); |
| 154 | if(this.lollipopsInputComment != null){ |
| 155 | this.renderArea.drawString(this.lollipopsInputComment, x + 31, y+4); |
| 156 | this.renderArea.addBold(x + 31, x + 31 + this.lollipopsInputComment.length, y+4); |
| 157 | } |
| 158 | // Put all that in the cauldron |
| 159 | this.renderArea.addAsciiRealButton("Put all that in the cauldron", x, y+6, "cauldronPutAllThatInTheCauldronButton", "", false, 4); |
| 160 | this.renderArea.addLinkCall(".cauldronPutAllThatInTheCauldronButton", new CallbackCollection(this.putInCauldron.bind(this))); |
| 161 | |
| 162 | // What is in the cauldron |
| 163 | // Text |
| 164 | this.renderArea.drawString(Database.getText("cauldronWhatIsIn"), x, y+9); // Normal |
| 165 | this.renderArea.addBold(x, x + Database.getText("cauldronWhatIsIn").length, y+9); // Add bold on normal |
| 166 | this.renderArea.drawString(Database.getTranslatedText("cauldronWhatIsIn"), x, y+10, true); // Translated |
| 167 | // Candies |
| 168 | this.renderArea.drawString("Candies :", x+2, y+11); |
| 169 | this.renderArea.drawString(Algo.numberToStringButNicely(this.getGame().getCandiesInCauldron().getCurrent()), x + 14, y + 11); |
| 170 | // Lollipops |
| 171 | this.renderArea.drawString("Lollipops :", x+2, y+12); |
| 172 | this.renderArea.drawString(Algo.numberToStringButNicely(this.getGame().getLollipopsInCauldron().getCurrent()), x + 14, y + 12); |
| 173 | |
| 174 | // What you can do with it |
| 175 | // Text |
| 176 | this.renderArea.drawString(Database.getText("cauldronWhatYouCanDo"), x, y+14); // Normal |
| 177 | this.renderArea.addBold(x, x + Database.getText("cauldronWhatYouCanDo").length, y+14); // Add bold on normal |
| 178 | this.renderArea.drawString(Database.getTranslatedText("cauldronWhatYouCanDo"), x, y+15, true); // Translated |
| 179 | // Mix button |
| 180 | this.renderArea.addAsciiRealButton("Mix", x, y+16, "cauldronMixButton", "", false, 0); |
no test coverage detected