MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / checkCandies

Method checkCandies

code/main/CandyBox.ts:137–165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

135
136 // Private methods
137 private checkCandies(): void{
138 // Possibly show the eat button
139 if(this.eatButtonShown == false){
140 if(this.getGame().getCandies().getMax() > 0){
141 this.eatButtonShown = true;
142 this.update();
143 this.getGame().updatePlace();
144 }
145 }
146
147 // Possibly show the throw button
148 if(this.throwButtonShown == false){
149 if(this.getGame().getCandies().getMax() >= 10){
150 this.throwButtonShown = true;
151 this.update();
152 this.getGame().updatePlace();
153 }
154 }
155
156 // Possibly show the request feature button
157 if(this.requestFeatureButtonShown == false){
158 // If we have enough candies & the last feature isn't unlocked yet
159 if(this.getGame().getCandies().getMax() >= 30 && Saving.loadBool("statusBarUnlockedMap") == false){
160 this.requestFeatureButtonShown = true;
161 this.update();
162 this.getGame().updatePlace();
163 }
164 }
165 }
166
167 private clickedEatCandiesButton(): void{
168 if(this.getGame().getCandies().getCurrent() >= 1){

Callers 1

willBeDisplayedMethod · 0.95

Calls 5

updateMethod · 0.95
getMaxMethod · 0.80
updatePlaceMethod · 0.80
getCandiesMethod · 0.45
getGameMethod · 0.45

Tested by

no test coverage detected