1 | var panelsData = [
|
---|
2 | { // Scores panel
|
---|
3 | "headings": [ // headings on score panel
|
---|
4 | { "caption": translate("Player name"), "yStart": 26, "width": 200 },
|
---|
5 | { "caption": translate("Economy score"), "yStart": 16, "width": 100 },
|
---|
6 | { "caption": translate("Military score"), "yStart": 16, "width": 100 },
|
---|
7 | { "caption": translate("Exploration score"), "yStart": 16, "width": 100 },
|
---|
8 | { "caption": translate("Total score"), "yStart": 16, "width": 100 }
|
---|
9 | ],
|
---|
10 | "titleHeadings": [],
|
---|
11 | "counters": [ // counters on score panel
|
---|
12 | { "width": 100, "fn": calculateEconomyScore },
|
---|
13 | { "width": 100, "fn": calculateMilitaryScore },
|
---|
14 | { "width": 100, "fn": calculateExplorationScore },
|
---|
15 | { "width": 100, "fn": calculateScoreTotal}
|
---|
16 | ],
|
---|
17 | "teamCounterFn": calculateScoreTeam
|
---|
18 | },
|
---|
19 | { // buildings panel
|
---|
20 | "headings": [ // headings on buildings panel
|
---|
21 | { "caption": translate("Player name"), "yStart": 26, "width": 200 },
|
---|
22 | { "caption": translate("Total"), "yStart": 34, "width": 105 },
|
---|
23 | { "caption": translate("Houses"), "yStart": 34, "width": 85 },
|
---|
24 | { "caption": translate("Economic"), "yStart": 34, "width": 85 },
|
---|
25 | { "caption": translate("Outposts"), "yStart": 34, "width": 85 },
|
---|
26 | { "caption": translate("Military"), "yStart": 34, "width": 85 },
|
---|
27 | { "caption": translate("Fortresses"), "yStart": 34, "width": 85 },
|
---|
28 | { "caption": translate("Civ centers"), "yStart": 34, "width": 110 },
|
---|
29 | { "caption": translate("Wonders"), "yStart": 34, "width": 85 }
|
---|
30 | ],
|
---|
31 | "titleHeadings": [
|
---|
32 | { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed)"), "yStart": 16, "width": (85 * 7 + 105) }, // width = 735
|
---|
33 | ],
|
---|
34 | "counters": [ // counters on buildings panel
|
---|
35 | {"width": 105, "fn": calculateBuildings},
|
---|
36 | {"width": 85, "fn": calculateBuildings},
|
---|
37 | {"width": 85, "fn": calculateBuildings},
|
---|
38 | {"width": 85, "fn": calculateBuildings},
|
---|
39 | {"width": 85, "fn": calculateBuildings},
|
---|
40 | {"width": 85, "fn": calculateBuildings},
|
---|
41 | {"width": 100, "fn": calculateBuildings},
|
---|
42 | {"width": 105, "fn": calculateBuildings}
|
---|
43 | ],
|
---|
44 | "teamCounterFn": calculateColorsTeam
|
---|
45 | },
|
---|
46 | { // units panel
|
---|
47 | "headings": [ // headings on units panel
|
---|
48 | { "caption": translate("Player name"), "yStart": 26, "width": 200 },
|
---|
49 | { "caption": translate("Total"), "yStart": 34, "width": 120 },
|
---|
50 | { "caption": translate("Infantry"), "yStart": 34, "width": 100 },
|
---|
51 | { "caption": translate("Worker"), "yStart": 34, "width": 100 },
|
---|
52 | { "caption": translate("Cavalry"), "yStart": 34, "width": 100 },
|
---|
53 | { "caption": translate("Champion"), "yStart": 34, "width": 100 },
|
---|
54 | { "caption": translate("Heroes"), "yStart": 34, "width": 100 },
|
---|
55 | { "caption": translate("Navy"), "yStart": 34, "width": 100 }
|
---|
56 | ],
|
---|
57 | "titleHeadings": [
|
---|
58 | { "caption": translate("Units Statistics (Trained / Lost / Killed)"), "yStart": 16, "width": (100 * 6 + 120) }, // width = 720
|
---|
59 | ],
|
---|
60 | "counters": [ // counters on units panel
|
---|
61 | {"width": 120, "fn": calculateUnits},
|
---|
62 | {"width": 100, "fn": calculateUnits},
|
---|
63 | {"width": 100, "fn": calculateUnits},
|
---|
64 | {"width": 100, "fn": calculateUnits},
|
---|
65 | {"width": 100, "fn": calculateUnits},
|
---|
66 | {"width": 100, "fn": calculateUnits},
|
---|
67 | {"width": 100, "fn": calculateUnits}
|
---|
68 | ],
|
---|
69 | "teamCounterFn": calculateColorsTeam
|
---|
70 | },
|
---|
71 | { // resources panel
|
---|
72 | "headings": [ // headings on resources panel
|
---|
73 | { "caption": translate("Player name"), "yStart": 26, "width": 200 },
|
---|
74 | { "caption": translate("Food"), "yStart": 34, "width": 100 },
|
---|
75 | { "caption": translate("Wood"), "yStart": 34, "width": 100 },
|
---|
76 | { "caption": translate("Stone"), "yStart": 34, "width": 100 },
|
---|
77 | { "caption": translate("Metal"), "yStart": 34, "width": 100 },
|
---|
78 | { "caption": translate("Total"), "yStart": 34, "width": 110 },
|
---|
79 | { "caption": translate("Treasures collected"), "yStart": 16, "width": 100 },
|
---|
80 | { "caption": translate("Tributes (Sent / Received)"), "yStart": 16, "width": 121 }
|
---|
81 | ],
|
---|
82 | "titleHeadings": [
|
---|
83 | { "caption": translate("Resource Statistics (Gathered / Used)"), "yStart": 16, "width": (100 * 4 + 110) }, // width = 510
|
---|
84 | ],
|
---|
85 | "counters": [ // counters on resources panel
|
---|
86 | {"width": 100, "fn": calculateResources},
|
---|
87 | {"width": 100, "fn": calculateResources},
|
---|
88 | {"width": 100, "fn": calculateResources},
|
---|
89 | {"width": 100, "fn": calculateResources},
|
---|
90 | {"width": 110, "fn": calculateTotalResources},
|
---|
91 | {"width": 100, "fn": calculateTreasureCollected},
|
---|
92 | {"width": 121, "fn": calculateTributeSent}
|
---|
93 | ],
|
---|
94 | "teamCounterFn": calculateResourcesTeam
|
---|
95 | },
|
---|
96 | { // market panel
|
---|
97 | "headings": [ // headings on market panel
|
---|
98 | { "caption": translate("Player name"), "yStart": 26, "width": 200 },
|
---|
99 | { "caption": translate("Food exchanged"), "yStart": 16, "width": 100 },
|
---|
100 | { "caption": translate("Wood exchanged"), "yStart": 16, "width": 100 },
|
---|
101 | { "caption": translate("Stone exchanged"), "yStart": 16, "width": 100 },
|
---|
102 | { "caption": translate("Metal exchanged"), "yStart": 16, "width": 100 },
|
---|
103 | { "caption": translate("Barter efficiency"), "yStart": 16, "width": 100 },
|
---|
104 | { "caption": translate("Trade income"), "yStart": 16, "width": 100 }
|
---|
105 | ],
|
---|
106 | "titleHeadings": [],
|
---|
107 | "counters": [ // counters on market panel
|
---|
108 | {"width": 100, "fn": calculateResourceExchanged},
|
---|
109 | {"width": 100, "fn": calculateResourceExchanged},
|
---|
110 | {"width": 100, "fn": calculateResourceExchanged},
|
---|
111 | {"width": 100, "fn": calculateResourceExchanged},
|
---|
112 | {"width": 100, "fn": calculateBatteryEfficiency},
|
---|
113 | {"width": 100, "fn": calculateTradeIncome}
|
---|
114 | ],
|
---|
115 | "teamCounterFn": calculateMarketTeam
|
---|
116 | },
|
---|
117 | { // miscellaneous panel
|
---|
118 | "headings": [ // headings on miscellaneous panel
|
---|
119 | { "caption": translate("Player name"), "yStart": 26, "width": 200 },
|
---|
120 | { "caption": translate("Vegetarian\nratio"), "yStart": 16, "width": 100 },
|
---|
121 | { "caption": translate("Feminisation"), "yStart": 26, "width": 125 },
|
---|
122 | { "caption": translate("Kill / Death\nratio"), "yStart": 16, "width": 105 },
|
---|
123 | { "caption": translate("Map\nexploration"), "yStart": 16, "width": 100 }
|
---|
124 | ],
|
---|
125 | "titleHeadings": [],
|
---|
126 | "counters": [ // counters on miscellaneous panel
|
---|
127 | {"width": 110, "fn": calculateVegetarianRatio},
|
---|
128 | {"width": 110, "fn": calculateFeminisation},
|
---|
129 | {"width": 115, "fn": calculateKillDeathRatio},
|
---|
130 | {"width": 100, "fn": calculateMapExploration}
|
---|
131 | ],
|
---|
132 | "teamCounterFn": calculateMiscellaneous
|
---|
133 | }
|
---|
134 | ];
|
---|
135 |
|
---|
136 | function resetGeneralPanel()
|
---|
137 | {
|
---|
138 | for (var h = 0; h < MAX_HEADINGTITLE; ++h)
|
---|
139 | {
|
---|
140 | Engine.GetGUIObjectByName("titleHeading["+ h +"]").hidden = true;
|
---|
141 | Engine.GetGUIObjectByName("Heading[" + h + "]").hidden = true;
|
---|
142 | for (var p = 0; p < MAX_SLOTS; ++p)
|
---|
143 | {
|
---|
144 | Engine.GetGUIObjectByName("valueData[" + p + "][" + h + "]").hidden = true;
|
---|
145 | for (var t = 0; t < MAX_TEAMS; ++t)
|
---|
146 | {
|
---|
147 | Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + h + "]").hidden = true;
|
---|
148 | Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + h + "]").hidden = true;
|
---|
149 | }
|
---|
150 | }
|
---|
151 | }
|
---|
152 | }
|
---|
153 |
|
---|
154 | function updateGeneralPanelHeadings(headings)
|
---|
155 | {
|
---|
156 | var left = 50;
|
---|
157 | for (var h in headings)
|
---|
158 | {
|
---|
159 | var headerGUIName = "playerNameHeading";
|
---|
160 | if (h > 0)
|
---|
161 | headerGUIName = "Heading[" + (h - 1) + "]";
|
---|
162 |
|
---|
163 | var headerGUI = Engine.GetGUIObjectByName(headerGUIName);
|
---|
164 | headerGUI.caption = headings[h].caption;
|
---|
165 | headerGUI.size = left + " " + headings[h].yStart + " " + (left + headings[h].width) + " 100%";
|
---|
166 | headerGUI.hidden = false;
|
---|
167 |
|
---|
168 | if (headings[h].width < LONG_HEADING_WIDTH)
|
---|
169 | left += headings[h].width;
|
---|
170 | }
|
---|
171 | }
|
---|
172 |
|
---|
173 | function updateGeneralPanelTitles(titleHeadings)
|
---|
174 | {
|
---|
175 | var left = 250;
|
---|
176 | for (var th in titleHeadings)
|
---|
177 | {
|
---|
178 | if (th >= MAX_HEADINGTITLE)
|
---|
179 | break;
|
---|
180 |
|
---|
181 | var headerGUI = Engine.GetGUIObjectByName("titleHeading["+ th +"]");
|
---|
182 | headerGUI.caption = titleHeadings[th].caption;
|
---|
183 | headerGUI.size = left + " " + titleHeadings[th].yStart + " " + (left + titleHeadings[th].width) + " 100%";
|
---|
184 | headerGUI.hidden = false;
|
---|
185 | }
|
---|
186 | }
|
---|
187 |
|
---|
188 | function updateGeneralPanelCounter(counters)
|
---|
189 | {
|
---|
190 | var rowPlayerObjectWidth = 0;
|
---|
191 | var left = 0;
|
---|
192 | for (var p = 0; p < MAX_SLOTS; ++p)
|
---|
193 | {
|
---|
194 | left = 240;
|
---|
195 | var counterObject;
|
---|
196 | for (var w in counters)
|
---|
197 | {
|
---|
198 | counterObject = Engine.GetGUIObjectByName("valueData[" + p + "][" + w + "]");
|
---|
199 | counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%";
|
---|
200 | counterObject.hidden = false;
|
---|
201 | left += counters[w].width;
|
---|
202 | }
|
---|
203 | if (rowPlayerObjectWidth == 0)
|
---|
204 | rowPlayerObjectWidth = left;
|
---|
205 |
|
---|
206 | var counterTotalObject;
|
---|
207 | for (var t = 0; t < MAX_TEAMS; ++t)
|
---|
208 | {
|
---|
209 | left = 240;
|
---|
210 | for (var w in counters)
|
---|
211 | {
|
---|
212 | counterObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]");
|
---|
213 | counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%";
|
---|
214 | counterObject.hidden = false;
|
---|
215 |
|
---|
216 | if (g_Teams[t])
|
---|
217 | {
|
---|
218 | var yStart = 30 + g_Teams[t] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 2;
|
---|
219 | counterTotalObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]");
|
---|
220 | counterTotalObject.size = (left + 20) + " " + yStart + " " + (left + counters[w].width) + " 100%";
|
---|
221 | counterTotalObject.hidden = false;
|
---|
222 | }
|
---|
223 |
|
---|
224 | left += counters[w].width;
|
---|
225 | }
|
---|
226 | }
|
---|
227 | }
|
---|
228 | return rowPlayerObjectWidth;
|
---|
229 | }
|
---|
230 |
|
---|
231 | function updateGeneralPanelTeams()
|
---|
232 | {
|
---|
233 | if (!g_Teams || g_WithoutTeam > 0)
|
---|
234 | Engine.GetGUIObjectByName("noTeamsBox").hidden = false;
|
---|
235 |
|
---|
236 | if (!g_Teams)
|
---|
237 | return;
|
---|
238 |
|
---|
239 | var yStart = TEAMS_BOX_Y_START + g_WithoutTeam * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP);
|
---|
240 | for (var i = 0; i < g_Teams.length; ++i)
|
---|
241 | {
|
---|
242 | var teamBox = Engine.GetGUIObjectByName("teamBoxt["+i+"]");
|
---|
243 | teamBox.hidden = false;
|
---|
244 | var teamBoxSize = teamBox.size;
|
---|
245 | teamBoxSize.top = yStart;
|
---|
246 | teamBox.size = teamBoxSize;
|
---|
247 |
|
---|
248 | yStart += 30 + g_Teams[i] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 32;
|
---|
249 |
|
---|
250 | Engine.GetGUIObjectByName("teamNameHeadingt["+i+"]").caption = "Team "+(i+1);
|
---|
251 |
|
---|
252 | var teamHeading = Engine.GetGUIObjectByName("teamHeadingt["+i+"]");
|
---|
253 | var yStartTotal = 30 + g_Teams[i] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 2;
|
---|
254 | teamHeading.size = "50 "+yStartTotal+" 100% "+(yStartTotal+20);
|
---|
255 | teamHeading.caption = translate("Team total");
|
---|
256 | }
|
---|
257 | // If there are no players without team, hide "player name" heading
|
---|
258 | if (!g_WithoutTeam)
|
---|
259 | Engine.GetGUIObjectByName("playerNameHeading").caption = "";
|
---|
260 | }
|
---|
261 |
|
---|
262 | function updateObjectPlayerPosition()
|
---|
263 | {
|
---|
264 | for (var h = 0; h < MAX_SLOTS; ++h)
|
---|
265 | {
|
---|
266 | var playerBox = Engine.GetGUIObjectByName("playerBox[" + h + "]");
|
---|
267 | var boxSize = playerBox.size;
|
---|
268 | boxSize.top += h * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP);
|
---|
269 | boxSize.bottom = boxSize.top + PLAYER_BOX_Y_SIZE;
|
---|
270 | playerBox.size = boxSize;
|
---|
271 |
|
---|
272 | for (var i = 0; i < MAX_TEAMS; ++i)
|
---|
273 | {
|
---|
274 | var playerBoxt = Engine.GetGUIObjectByName("playerBoxt[" + i + "][" + h + "]");
|
---|
275 | boxSize = playerBoxt.size;
|
---|
276 | boxSize.top += h * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP);
|
---|
277 | boxSize.bottom = boxSize.top + PLAYER_BOX_Y_SIZE;
|
---|
278 | playerBoxt.size = boxSize;
|
---|
279 | };
|
---|
280 | };
|
---|
281 | }
|
---|