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

Method drawItems

code/main/SecondHouse.ts:105–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103 }
104
105 private drawItems(): void{
106 for(var i = 0; i < this.items.length; i++){
107 // If we can show this item
108 if(this.items[i].canBeShown()){
109 // We draw the item at the correct position
110 this.renderArea.drawArray(Database.getAscii(this.items[i].getAsciiName()), this.items[i].getAsciiPosition().x, this.items[i].getAsciiPosition().y, new RenderTransparency(" ", "%"));
111
112 // If it can be clicked
113 if(this.items[i].canBeClicked()){
114 // We add the button and the link to be able to click it (we add it on each line of the ascii art)
115 for(var j = 0; j < Database.getAsciiHeight(this.items[i].getAsciiName()); j++){
116 // Button
117 this.renderArea.addAsciiButton(this.items[i].getAsciiPosition().x, this.items[i].getAsciiPosition().x + Database.getAsciiWidth(this.items[i].getAsciiName()), this.items[i].getAsciiPosition().y + j, this.items[i].getButtonName() + "RealItem");
118 // Link
119 this.renderArea.addLinkCall("." + this.items[i].getButtonName() + "RealItem", new CallbackCollection(this.clickedOnItem.bind(this, i)));
120 }
121 }
122 }
123 }
124 }
125
126 private drawSelectedItemStuff(): void{
127 var yPos: number; // Will contain the y position of the bottom of the speech

Callers 1

updateMethod · 0.95

Calls 10

drawArrayMethod · 0.80
getAsciiMethod · 0.80
getAsciiNameMethod · 0.80
getAsciiPositionMethod · 0.80
addAsciiButtonMethod · 0.80
getButtonNameMethod · 0.80
addLinkCallMethod · 0.80
bindMethod · 0.80
canBeShownMethod · 0.45
canBeClickedMethod · 0.45

Tested by

no test coverage detected