Ticket #3518: ticket3518_summarystyle_2.diff
File ticket3518_summarystyle_2.diff, 22.9 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/summary/counters.js
2 2 var teamMiscHelperData = []; 3 3 4 4 function resetDataHelpers() 5 {6 5 teamMiscHelperData = []; 7 }8 6 9 7 function updateCountersPlayer(playerState, counters, idGUI) 10 8 { 11 for ( varw in counters)9 for (let w in counters) 12 10 { 13 11 var fn = counters[w].fn; 14 12 Engine.GetGUIObjectByName(idGUI + "[" + w + "]").caption = fn && fn(playerState, w); … … 18 16 function calculateEconomyScore(playerState, position) 19 17 { 20 18 let total = 0; 21 for each ( varres in playerState.statistics.resourcesGathered)19 for each (let res in playerState.statistics.resourcesGathered) 22 20 total += res; 23 21 24 22 return Math.round(total / 10); … … 44 42 45 43 function calculateScoreTeam(counters) 46 44 { 47 for ( vart in g_Teams)45 for (let t in g_Teams) 48 46 { 49 47 if (t == -1) 50 48 continue; 51 49 52 for ( varw in counters)50 for (let w in counters) 53 51 { 54 52 var total = 0; 55 for ( varp = 0; p < g_Teams[t]; ++p)53 for (let p = 0; p < g_Teams[t]; ++p) 56 54 total += (+Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption); 57 55 58 56 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = total; … … 62 60 63 61 function calculateBuildings(playerState, position) 64 62 { 65 var type = BUILDINGS_TYPES[position];66 return TRAINED_COLOR+ playerState.statistics.buildingsConstructed[type] + '[/color] / ' +67 LOST_COLOR+ playerState.statistics.buildingsLost[type] + '[/color] / ' +68 KILLED_COLOR+ playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]';63 var type = g_BuildingsTypes[position]; 64 return g_TrainedColor + playerState.statistics.buildingsConstructed[type] + '[/color] / ' + 65 g_LostColor + playerState.statistics.buildingsLost[type] + '[/color] / ' + 66 g_KilledColor + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]'; 69 67 } 70 68 71 69 function calculateColorsTeam(counters) 72 70 { 73 for ( vart in g_Teams)71 for (let t in g_Teams) 74 72 { 75 73 if (t == -1) 76 74 continue; 77 75 78 for ( varw in counters)76 for (let w in counters) 79 77 { 80 78 var total = { 81 79 c : 0, … … 82 80 l : 0, 83 81 d : 0 84 82 }; 85 for ( varp = 0; p < g_Teams[t]; ++p)83 for (let p = 0; p < g_Teams[t]; ++p) 86 84 { 87 85 var caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption; 88 86 // clean [Color=""], [/Color] and white space for make the sum more easy … … 94 92 total.l += (+splitCaption[1]); 95 93 total.d += (+splitCaption[2]); 96 94 } 97 var teamTotal = TRAINED_COLOR+ total.c + '[/color] / ' +98 LOST_COLOR + total.l + '[/color] / ' + KILLED_COLOR+ total.d + '[/color]';95 var teamTotal = g_Trained_Color + total.c + '[/color] / ' + 96 g_Lost_Color + total.l + '[/color] / ' + g_Killed_Color + total.d + '[/color]'; 99 97 100 98 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; 101 99 } … … 104 102 105 103 function calculateUnits(playerState, position) 106 104 { 107 var type = UNITS_TYPES[position];108 return TRAINED_COLOR+ playerState.statistics.unitsTrained[type] + '[/color] / ' +109 LOST_COLOR+ playerState.statistics.unitsLost[type] + '[/color] / ' +110 KILLED_COLOR+ playerState.statistics.enemyUnitsKilled[type] + '[/color]';105 var type = g_UnitsTypes[position]; 106 return g_TrainedColor + playerState.statistics.unitsTrained[type] + '[/color] / ' + 107 g_LostColor + playerState.statistics.unitsLost[type] + '[/color] / ' + 108 g_KilledColor + playerState.statistics.enemyUnitsKilled[type] + '[/color]'; 111 109 } 112 110 113 111 function calculateResources(playerState, position) 114 112 { 115 var type = RESOURCES_TYPES[position];116 return INCOME_COLOR+ playerState.statistics.resourcesGathered[type] + '[/color] / ' +117 OUTCOME_COLOR+ (playerState.statistics.resourcesUsed[type] - playerState.statistics.resourcesSold[type]) + '[/color]';113 var type = g_ResourcesTypes[position]; 114 return g_IncomeColor + playerState.statistics.resourcesGathered[type] + '[/color] / ' + 115 g_OutcomeColor + (playerState.statistics.resourcesUsed[type] - playerState.statistics.resourcesSold[type]) + '[/color]'; 118 116 } 119 117 120 118 function calculateTotalResources(playerState, position) … … 122 120 var totalGathered = 0; 123 121 var totalUsed = 0; 124 122 125 for each ( var type in RESOURCES_TYPES)123 for each (let type in g_ResourcesTypes) 126 124 { 127 125 totalGathered += playerState.statistics.resourcesGathered[type]; 128 126 totalUsed += playerState.statistics.resourcesUsed[type] - playerState.statistics.resourcesSold[type]; 129 127 } 130 128 131 return INCOME_COLOR + totalGathered + '[/color] / ' + OUTCOME_COLOR+ totalUsed + '[/color]';129 return g_IncomeColor + totalGathered + '[/color] / ' + g_OutcomeColor + totalUsed + '[/color]'; 132 130 } 133 131 134 132 function calculateTreasureCollected(playerState, position) … … 143 141 144 142 function calculateTributeSent(playerState, position) 145 143 { 146 return INCOME_COLOR + playerState.statistics.tributesSent + "[/color] / " + OUTCOME_COLOR + playerState.statistics.tributesReceived + "[/color]"; 144 return g_IncomeColor + playerState.statistics.tributesSent + "[/color] / " + 145 g_OutcomeColor + playerState.statistics.tributesReceived + "[/color]"; 147 146 } 148 147 149 148 function calculateResourcesTeam(counters) 150 149 { 151 for ( vart in g_Teams)150 for (let t in g_Teams) 152 151 { 153 152 if (t == -1) 154 153 continue; 155 154 156 for ( varw in counters)155 for (let w in counters) 157 156 { 158 157 var teamTotal = "undefined"; 159 158 … … 161 160 i : 0, 162 161 o : 0 163 162 }; 164 for ( varp = 0; p < g_Teams[t]; ++p)163 for (let p = 0; p < g_Teams[t]; ++p) 165 164 { 166 165 var caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption; 167 166 // clean [Color=""], [/Color] and white space for make the sum more easy … … 181 180 if (w >= 6) 182 181 teamTotal = total.i; 183 182 else 184 teamTotal = INCOME_COLOR + total.i + "[/color] / " + OUTCOME_COLOR+ total.o + "[/color]";183 teamTotal = g_IncomeColor + total.i + "[/color] / " + g_OutcomeColor + total.o + "[/color]"; 185 184 186 185 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; 187 186 } … … 190 189 191 190 function calculateResourceExchanged(playerState, position) 192 191 { 193 var type = RESOURCES_TYPES[position];194 return INCOME_COLOR+ '+' + playerState.statistics.resourcesBought[type] + '[/color] ' +195 OUTCOME_COLOR+ '-' + playerState.statistics.resourcesSold[type] + '[/color]';192 var type = g_ResourcesTypes[position]; 193 return g_IncomeColor + '+' + playerState.statistics.resourcesBought[type] + '[/color] ' + 194 g_OutcomeColor + '-' + playerState.statistics.resourcesSold[type] + '[/color]'; 196 195 } 197 196 198 197 function calculateBatteryEfficiency(playerState, position) 199 198 { 200 199 var totalBought = 0; 201 for each ( varboughtAmount in playerState.statistics.resourcesBought)200 for each (let boughtAmount in playerState.statistics.resourcesBought) 202 201 totalBought += boughtAmount; 203 202 var totalSold = 0; 204 for each ( varsoldAmount in playerState.statistics.resourcesSold)203 for each (let soldAmount in playerState.statistics.resourcesSold) 205 204 totalSold += soldAmount; 206 205 207 206 return Math.floor(totalSold > 0 ? (totalBought / totalSold) * 100 : 0) + "%"; … … 214 213 215 214 function calculateMarketTeam(counters) 216 215 { 217 for ( vart in g_Teams)216 for (let t in g_Teams) 218 217 { 219 218 if (t == -1) 220 219 continue; 221 220 222 for ( varw in counters)221 for (let w in counters) 223 222 { 224 223 var teamTotal = "undefined"; 225 224 … … 227 226 i : 0, 228 227 o : 0 229 228 }; 230 for ( varp = 0; p < g_Teams[t]; ++p)229 for (let p = 0; p < g_Teams[t]; ++p) 231 230 { 232 231 var caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption; 233 232 // clean [Color=""], [/Color], white space, + and % for make the sum more easy … … 246 245 if (w >= 4) 247 246 teamTotal = total.i +(w == 4 ? "%" : ""); 248 247 else 249 teamTotal = INCOME_COLOR + '+' + total.i + '[/color] ' + OUTCOME_COLOR+ '-' + total.o + '[/color]';248 teamTotal = g_IncomeColor + '+' + total.i + '[/color] ' + g_IncomeColor + '-' + total.o + '[/color]'; 250 249 251 250 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; 252 251 } … … 298 297 teamMiscHelperData[playerState.team][position].unitsLost = playerState.statistics.unitsLost.total; 299 298 300 299 if (!playerState.statistics.enemyUnitsKilled.total) 301 return DEFAULT_DECIMAL;300 return g_DefaultDecimal 302 301 if (!playerState.statistics.unitsLost.total) // and enemyUnitsKilled.total > 0 303 return INFINITE_SYMBOL; // infinity symbol302 return g_InfiniteSymbol; // infinity symbol 304 303 305 304 return Math.round((playerState.statistics.enemyUnitsKilled.total / playerState.statistics.unitsLost.total)*100)/100; 306 305 } … … 334 333 335 334 function calculateMiscellaneous(counters) 336 335 { 337 for ( vart in g_Teams)336 for (let t in g_Teams) 338 337 { 339 338 if (t == -1) 340 339 continue; 341 340 342 for ( varw in counters)341 for (let w in counters) 343 342 { 344 343 var teamTotal = "undefined"; 345 344 … … 350 349 else if (w == 2) 351 350 { 352 351 if (!teamMiscHelperData[t][w].enemyUnitsKilled) 353 teamTotal = DEFAULT_DECIMAL;352 teamTotal = g_DefaultDecimal; 354 353 else if (!teamMiscHelperData[t][w].unitsLost) // and enemyUnitsKilled.total > 0 355 teamTotal = INFINITE_SYMBOL; // infinity symbol354 teamTotal = g_InfiniteSymbol; // infinity symbol 356 355 else 357 356 teamTotal = Math.round((teamMiscHelperData[t][w].enemyUnitsKilled / teamMiscHelperData[t][w].unitsLost)*100)/100; 358 357 } -
binaries/data/mods/public/gui/summary/layout.js
16 16 ], 17 17 "teamCounterFn": calculateScoreTeam 18 18 }, 19 19 { // buildings panel 20 20 "headings": [ // headings on buildings panel 21 21 { "caption": translate("Player name"), "yStart": 26, "width": 200 }, 22 22 { "caption": translate("Total"), "yStart": 34, "width": 105 }, … … 32 32 { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed)"), "yStart": 16, "width": (85 * 7 + 105) }, // width = 700 33 33 ], 34 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": 85, "fn": calculateBuildings},42 { "width": 85, "fn": calculateBuildings}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": 85, "fn": calculateBuildings }, 42 { "width": 85, "fn": calculateBuildings } 43 43 ], 44 44 "teamCounterFn": calculateColorsTeam 45 45 }, … … 59 59 { "caption": translate("Units Statistics (Trained / Lost / Killed)"), "yStart": 16, "width": (100 * 7 + 120) }, // width = 820 60 60 ], 61 61 "counters": [ // counters on units panel 62 { "width": 120, "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 { "width": 100, "fn": calculateUnits},69 { "width": 100, "fn": calculateUnits}62 { "width": 120, "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 { "width": 100, "fn": calculateUnits }, 69 { "width": 100, "fn": calculateUnits } 70 70 ], 71 71 "teamCounterFn": calculateColorsTeam 72 72 }, … … 86 86 { "caption": translate("Resource Statistics (Gathered / Used)"), "yStart": 16, "width": (100 * 4 + 110) }, // width = 510 87 87 ], 88 88 "counters": [ // counters on resources panel 89 { "width": 100, "fn": calculateResources},90 { "width": 100, "fn": calculateResources},91 { "width": 100, "fn": calculateResources},92 { "width": 100, "fn": calculateResources},93 { "width": 110, "fn": calculateTotalResources},94 { "width": 121, "fn": calculateTributeSent},95 { "width": 100, "fn": calculateTreasureCollected},96 { "width": 100, "fn": calculateLootCollected}89 { "width": 100, "fn": calculateResources }, 90 { "width": 100, "fn": calculateResources }, 91 { "width": 100, "fn": calculateResources }, 92 { "width": 100, "fn": calculateResources }, 93 { "width": 110, "fn": calculateTotalResources }, 94 { "width": 121, "fn": calculateTributeSent }, 95 { "width": 100, "fn": calculateTreasureCollected }, 96 { "width": 100, "fn": calculateLootCollected } 97 97 ], 98 98 "teamCounterFn": calculateResourcesTeam 99 99 }, … … 109 109 ], 110 110 "titleHeadings": [], 111 111 "counters": [ // counters on market panel 112 { "width": 100, "fn": calculateResourceExchanged},113 { "width": 100, "fn": calculateResourceExchanged},114 { "width": 100, "fn": calculateResourceExchanged},115 { "width": 100, "fn": calculateResourceExchanged},116 { "width": 100, "fn": calculateBatteryEfficiency},117 { "width": 100, "fn": calculateTradeIncome}112 { "width": 100, "fn": calculateResourceExchanged }, 113 { "width": 100, "fn": calculateResourceExchanged }, 114 { "width": 100, "fn": calculateResourceExchanged }, 115 { "width": 100, "fn": calculateResourceExchanged }, 116 { "width": 100, "fn": calculateBatteryEfficiency }, 117 { "width": 100, "fn": calculateTradeIncome } 118 118 ], 119 119 "teamCounterFn": calculateMarketTeam 120 120 }, … … 132 132 { "caption": translate("Map control"), "xOffset": 400, "yStart": 16, "width": 200 } 133 133 ], 134 134 "counters": [ // counters on miscellaneous panel 135 { "width": 100, "fn": calculateVegetarianRatio},136 { "width": 100, "fn": calculateFeminization},137 { "width": 100, "fn": calculateKillDeathRatio},138 { "width": 100, "fn": calculateMapExploration},139 { "width": 100, "fn": calculateMapPeakControl},140 { "width": 100, "fn": calculateMapFinalControl}135 { "width": 100, "fn": calculateVegetarianRatio }, 136 { "width": 100, "fn": calculateFeminization }, 137 { "width": 100, "fn": calculateKillDeathRatio }, 138 { "width": 100, "fn": calculateMapExploration }, 139 { "width": 100, "fn": calculateMapPeakControl }, 140 { "width": 100, "fn": calculateMapFinalControl } 141 141 ], 142 142 "teamCounterFn": calculateMiscellaneous 143 143 } … … 145 145 146 146 function resetGeneralPanel() 147 147 { 148 for (var h = 0; h < MAX_HEADINGTITLE; ++h)148 for (var h = 0; h < g_MaxHeadingTitle; ++h) 149 149 { 150 150 Engine.GetGUIObjectByName("titleHeading["+ h +"]").hidden = true; 151 151 Engine.GetGUIObjectByName("Heading[" + h + "]").hidden = true; … … 164 164 function updateGeneralPanelHeadings(headings) 165 165 { 166 166 var left = 50; 167 for ( varh in headings)167 for (let h in headings) 168 168 { 169 169 var headerGUIName = "playerNameHeading"; 170 170 if (h > 0) … … 175 175 headerGUI.size = left + " " + headings[h].yStart + " " + (left + headings[h].width) + " 100%"; 176 176 headerGUI.hidden = false; 177 177 178 if (headings[h].width < LONG_HEADING_WIDTH)178 if (headings[h].width < g_LongHeadingWidth) 179 179 left += headings[h].width; 180 180 } 181 181 } … … 183 183 function updateGeneralPanelTitles(titleHeadings) 184 184 { 185 185 var left = 250; 186 for ( varth in titleHeadings)186 for (let th in titleHeadings) 187 187 { 188 if (th >= MAX_HEADINGTITLE)188 if (th >= g_MaxHeadingTitle) 189 189 break; 190 190 191 191 if (titleHeadings[th].xOffset) … … 196 196 headerGUI.size = left + " " + titleHeadings[th].yStart + " " + (left + titleHeadings[th].width) + " 100%"; 197 197 headerGUI.hidden = false; 198 198 199 if (titleHeadings[th].width < LONG_HEADING_WIDTH)199 if (titleHeadings[th].width < g_LongHeadingWidth) 200 200 left += titleHeadings[th].width; 201 201 } 202 202 } … … 209 209 { 210 210 left = 240; 211 211 var counterObject; 212 for ( varw in counters)212 for (let w in counters) 213 213 { 214 214 counterObject = Engine.GetGUIObjectByName("valueData[" + p + "][" + w + "]"); 215 215 counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%"; … … 223 223 for (let t = 0; t < g_MaxTeams; ++t) 224 224 { 225 225 left = 240; 226 for ( varw in counters)226 for (let w in counters) 227 227 { 228 228 counterObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]"); 229 229 counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%"; … … 231 231 232 232 if (g_Teams[t]) 233 233 { 234 var yStart = 30 + g_Teams[t] * ( PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 2;234 var yStart = 30 + g_Teams[t] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 2; 235 235 counterTotalObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]"); 236 236 counterTotalObject.size = (left + 20) + " " + yStart + " " + (left + counters[w].width) + " 100%"; 237 237 counterTotalObject.hidden = false; … … 252 252 if (!g_Teams) 253 253 return; 254 254 255 var yStart = TEAMS_BOX_Y_START + g_WithoutTeam * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP);256 for ( vari = 0; i < g_Teams.length; ++i)255 var yStart = g_TeamsBoxYStart + g_WithoutTeam * (g_PlayerBoxYSize + g_PlayerBoxGap); 256 for (let i = 0; i < g_Teams.length; ++i) 257 257 { 258 258 if (!g_Teams[i]) 259 259 continue; … … 264 264 teamBoxSize.top = yStart; 265 265 teamBox.size = teamBoxSize; 266 266 267 yStart += 30 + g_Teams[i] * ( PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 32;267 yStart += 30 + g_Teams[i] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 32; 268 268 269 269 Engine.GetGUIObjectByName("teamNameHeadingt["+i+"]").caption = "Team "+(i+1); 270 270 271 271 var teamHeading = Engine.GetGUIObjectByName("teamHeadingt["+i+"]"); 272 var yStartTotal = 30 + g_Teams[i] * ( PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 2;272 var yStartTotal = 30 + g_Teams[i] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 2; 273 273 teamHeading.size = "50 "+yStartTotal+" 100% "+(yStartTotal+20); 274 274 teamHeading.caption = translate("Team total"); 275 275 } … … 284 284 { 285 285 var playerBox = Engine.GetGUIObjectByName("playerBox[" + h + "]"); 286 286 var boxSize = playerBox.size; 287 boxSize.top += h * ( PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP);288 boxSize.bottom = boxSize.top + PLAYER_BOX_Y_SIZE;287 boxSize.top += h * (g_PlayerBoxYSize + g_PlayerBoxGap); 288 boxSize.bottom = boxSize.top + g_PlayerBoxYSize; 289 289 playerBox.size = boxSize; 290 290 291 291 for (let i = 0; i < g_MaxTeams; ++i) … … 292 292 { 293 293 var playerBoxt = Engine.GetGUIObjectByName("playerBoxt[" + i + "][" + h + "]"); 294 294 boxSize = playerBoxt.size; 295 boxSize.top += h * ( PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP);296 boxSize.bottom = boxSize.top + PLAYER_BOX_Y_SIZE;295 boxSize.top += h * (g_PlayerBoxYSize + g_PlayerBoxGap); 296 boxSize.bottom = boxSize.top + g_PlayerBoxYSize; 297 297 playerBoxt.size = boxSize; 298 298 } 299 299 } -
binaries/data/mods/public/gui/summary/summary.js
1 const MAX_HEADINGTITLE= 8;1 const g_MaxHeadingTitle= 8; 2 2 3 3 // const for filtering long collective headings 4 const LONG_HEADING_WIDTH= 250;4 const g_LongHeadingWidth = 250; 5 5 // Vertical size of player box 6 const PLAYER_BOX_Y_SIZE= 30;6 const g_PlayerBoxYSize = 30; 7 7 // Gap between players boxes 8 const PLAYER_BOX_GAP= 2;8 const g_PlayerBoxGap = 2; 9 9 // Alpha for player box 10 const PLAYER_BOX_ALPHA= " 32";10 const g_PlayerBoxAlpha = " 32"; 11 11 // Alpha for player color box 12 const PLAYER_COLOR_BOX_ALPHA= " 255";12 const g_PlayerColorBoxAlpha = " 255"; 13 13 // yStart value for spacing teams boxes (and noTeamsBox) 14 const TEAMS_BOX_Y_START= 65;14 const g_TeamsBoxYStart = 65; 15 15 // Colors used for units and buildings 16 const TRAINED_COLOR= '[color="201 255 200"]';17 const LOST_COLOR= '[color="255 213 213"]';18 const KILLED_COLOR= '[color="196 198 255"]';16 const g_TrainedColor = '[color="201 255 200"]'; 17 const g_LostColor = '[color="255 213 213"]'; 18 const g_KilledColor = '[color="196 198 255"]'; 19 19 20 const BUILDINGS_TYPES= [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ];21 const UNITS_TYPES= [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship", "Trader" ];22 const RESOURCES_TYPES= [ "food", "wood", "stone", "metal" ];20 const g_BuildingsTypes = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ]; 21 const g_UnitsTypes = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship", "Trader" ]; 22 const g_ResourcesTypes = [ "food", "wood", "stone", "metal" ]; 23 23 24 24 // Colors used for gathered and traded resources 25 const INCOME_COLOR= '[color="201 255 200"]';26 const OUTCOME_COLOR= '[color="255 213 213"]';25 const g_IncomeColor = '[color="201 255 200"]'; 26 const g_OutcomeColor = '[color="255 213 213"]'; 27 27 28 const DEFAULT_DECIMAL= "0.00";29 const INFINITE_SYMBOL= "\u221E";28 const g_DefaultDecimal = "0.00"; 29 const g_InfiniteSymbol = "\u221E"; 30 30 // Load data 31 31 var g_CivData = loadCivData(); 32 32 var g_Teams = []; … … 52 52 rightSpacer.size = (tabSize.right - 2) + " " + rightSpacer.size.top + " 100%-20 " + rightSpacer.size.bottom; 53 53 } 54 54 55 for ( vari = 0; i < panelNames.length; ++i)55 for (let i = 0; i < panelNames.length; ++i) 56 56 { 57 57 Engine.GetGUIObjectByName(panelNames[i] + 'Button').sprite = "BackgroundTab"; 58 58 } … … 73 73 updateGeneralPanelTeams(); 74 74 75 75 var playerBoxesCounts = [ ]; 76 for ( vari = 0; i < g_PlayerCount; ++i)76 for (let i = 0; i < g_PlayerCount; ++i) 77 77 { 78 78 var playerState = g_GameData.playerStates[i+1]; 79 79 … … 104 104 105 105 var rowPlayerObject = Engine.GetGUIObjectByName(rowPlayer); 106 106 rowPlayerObject.hidden = false; 107 rowPlayerObject.sprite = colorString + PLAYER_BOX_ALPHA;107 rowPlayerObject.sprite = colorString + g_PlayerBoxAlpha; 108 108 var boxSize = rowPlayerObject.size; 109 109 boxSize.right = rowPlayerObjectWidth; 110 110 rowPlayerObject.size = boxSize; 111 111 112 112 var playerColorBox = Engine.GetGUIObjectByName(playerColorBoxColumn); 113 playerColorBox.sprite = colorString + PLAYER_COLOR_BOX_ALPHA;113 playerColorBox.sprite = colorString + g_PlayerColorBoxAlpha; 114 114 115 115 Engine.GetGUIObjectByName(playerNameColumn).caption = g_GameData.players[i+1].name; 116 116 … … 146 146 var mapSizes = initMapSizes(); 147 147 148 148 // retrieve the index of the map size 149 for ( varmapSizeIndex in mapSizes.tiles)149 for (let mapSizeIndex in mapSizes.tiles) 150 150 { 151 151 if (mapSizes.tiles[mapSizeIndex] == data.mapSettings.Size) 152 152 { … … 164 164 if (data.mapSettings.LockTeams) // teams ARE locked 165 165 { 166 166 // Count teams 167 for( vart = 0; t < g_PlayerCount; ++t)167 for(let t = 0; t < g_PlayerCount; ++t) 168 168 { 169 169 let playerTeam = data.playerStates[t+1].team; 170 170 if (g_Teams[playerTeam]) … … 182 182 // Erase teams data if teams are not displayed 183 183 if (!g_Teams) 184 184 { 185 for( varp = 0; p < g_PlayerCount; ++p)185 for(let p = 0; p < g_PlayerCount; ++p) 186 186 data.playerStates[p+1].team = -1; 187 187 } 188 188 … … 190 190 if (g_Teams) 191 191 { 192 192 // Count players without team (or all if teams are not displayed) 193 for ( vari = 0; i < g_Teams.length; ++i)193 for (let i = 0; i < g_Teams.length; ++i) 194 194 g_WithoutTeam -= g_Teams[i] ? g_Teams[i] : 0; 195 195 }