diff --git a/binaries/data/mods/public/gui/summary/counters.js b/binaries/data/mods/public/gui/summary/counters.js index 8929b3fe45..c90dab33c8 100644 --- a/binaries/data/mods/public/gui/summary/counters.js +++ b/binaries/data/mods/public/gui/summary/counters.js @@ -8,7 +8,7 @@ function resetDataHelpers() function updateCountersPlayer(playerState, counters, idGUI) { - for (var w in counters) + for (let w in counters) { var fn = counters[w].fn; Engine.GetGUIObjectByName(idGUI + "[" + w + "]").caption = fn && fn(playerState, w); @@ -18,7 +18,7 @@ function updateCountersPlayer(playerState, counters, idGUI) function calculateEconomyScore(playerState, position) { let total = 0; - for each (var res in playerState.statistics.resourcesGathered) + for each (let res in playerState.statistics.resourcesGathered) total += res; return Math.round(total / 10); @@ -44,15 +44,15 @@ function calculateScoreTotal(playerState, position) function calculateScoreTeam(counters) { - for (var t in g_Teams) + for (let t in g_Teams) { if (t == -1) continue; - for (var w in counters) + for (let w in counters) { var total = 0; - for (var p = 0; p < g_Teams[t]; ++p) + for (let p = 0; p < g_Teams[t]; ++p) total += (+Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption); Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = total; @@ -62,27 +62,27 @@ function calculateScoreTeam(counters) function calculateBuildings(playerState, position) { - var type = BUILDINGS_TYPES[position]; - return TRAINED_COLOR + playerState.statistics.buildingsConstructed[type] + '[/color] / ' + - LOST_COLOR + playerState.statistics.buildingsLost[type] + '[/color] / ' + - KILLED_COLOR + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]'; + var type = g_BuildingsTypes[position]; + return g_TrainedColor + playerState.statistics.buildingsConstructed[type] + '[/color] / ' + + g_LostColor + playerState.statistics.buildingsLost[type] + '[/color] / ' + + g_KilledColor + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]'; } function calculateColorsTeam(counters) { - for (var t in g_Teams) + for (let t in g_Teams) { if (t == -1) continue; - for (var w in counters) + for (let w in counters) { var total = { c : 0, l : 0, d : 0 }; - for (var p = 0; p < g_Teams[t]; ++p) + for (let p = 0; p < g_Teams[t]; ++p) { var caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption; // clean [Color=""], [/Color] and white space for make the sum more easy @@ -94,8 +94,8 @@ function calculateColorsTeam(counters) total.l += (+splitCaption[1]); total.d += (+splitCaption[2]); } - var teamTotal = TRAINED_COLOR + total.c + '[/color] / ' + - LOST_COLOR + total.l + '[/color] / ' + KILLED_COLOR + total.d + '[/color]'; + var teamTotal = g_Trained_Color + total.c + '[/color] / ' + + g_Lost_Color + total.l + '[/color] / ' + g_Killed_Color + total.d + '[/color]'; Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; } @@ -104,17 +104,17 @@ function calculateColorsTeam(counters) function calculateUnits(playerState, position) { - var type = UNITS_TYPES[position]; - return TRAINED_COLOR + playerState.statistics.unitsTrained[type] + '[/color] / ' + - LOST_COLOR + playerState.statistics.unitsLost[type] + '[/color] / ' + - KILLED_COLOR + playerState.statistics.enemyUnitsKilled[type] + '[/color]'; + var type = g_UnitsTypes[position]; + return g_TrainedColor + playerState.statistics.unitsTrained[type] + '[/color] / ' + + g_LostColor + playerState.statistics.unitsLost[type] + '[/color] / ' + + g_KilledColor + playerState.statistics.enemyUnitsKilled[type] + '[/color]'; } function calculateResources(playerState, position) { - var type = RESOURCES_TYPES[position]; - return INCOME_COLOR + playerState.statistics.resourcesGathered[type] + '[/color] / ' + - OUTCOME_COLOR + (playerState.statistics.resourcesUsed[type] - playerState.statistics.resourcesSold[type]) + '[/color]'; + var type = g_ResourcesTypes[position]; + return g_IncomeColor + playerState.statistics.resourcesGathered[type] + '[/color] / ' + + g_OutcomeColor + (playerState.statistics.resourcesUsed[type] - playerState.statistics.resourcesSold[type]) + '[/color]'; } function calculateTotalResources(playerState, position) @@ -122,13 +122,13 @@ function calculateTotalResources(playerState, position) var totalGathered = 0; var totalUsed = 0; - for each (var type in RESOURCES_TYPES) + for each (let type in g_ResourcesTypes) { totalGathered += playerState.statistics.resourcesGathered[type]; totalUsed += playerState.statistics.resourcesUsed[type] - playerState.statistics.resourcesSold[type]; } - return INCOME_COLOR + totalGathered + '[/color] / ' + OUTCOME_COLOR + totalUsed + '[/color]'; + return g_IncomeColor + totalGathered + '[/color] / ' + g_OutcomeColor + totalUsed + '[/color]'; } function calculateTreasureCollected(playerState, position) @@ -143,17 +143,18 @@ function calculateLootCollected(playerState, position) function calculateTributeSent(playerState, position) { - return INCOME_COLOR + playerState.statistics.tributesSent + "[/color] / " + OUTCOME_COLOR + playerState.statistics.tributesReceived + "[/color]"; + return g_IncomeColor + playerState.statistics.tributesSent + "[/color] / " + + g_OutcomeColor + playerState.statistics.tributesReceived + "[/color]"; } function calculateResourcesTeam(counters) { - for (var t in g_Teams) + for (let t in g_Teams) { if (t == -1) continue; - for (var w in counters) + for (let w in counters) { var teamTotal = "undefined"; @@ -161,7 +162,7 @@ function calculateResourcesTeam(counters) i : 0, o : 0 }; - for (var p = 0; p < g_Teams[t]; ++p) + for (let p = 0; p < g_Teams[t]; ++p) { var caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption; // clean [Color=""], [/Color] and white space for make the sum more easy @@ -181,7 +182,7 @@ function calculateResourcesTeam(counters) if (w >= 6) teamTotal = total.i; else - teamTotal = INCOME_COLOR + total.i + "[/color] / " + OUTCOME_COLOR + total.o + "[/color]"; + teamTotal = g_IncomeColor + total.i + "[/color] / " + g_OutcomeColor + total.o + "[/color]"; Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; } @@ -190,18 +191,18 @@ function calculateResourcesTeam(counters) function calculateResourceExchanged(playerState, position) { - var type = RESOURCES_TYPES[position]; - return INCOME_COLOR + '+' + playerState.statistics.resourcesBought[type] + '[/color] ' + - OUTCOME_COLOR + '-' + playerState.statistics.resourcesSold[type] + '[/color]'; + var type = g_ResourcesTypes[position]; + return g_IncomeColor + '+' + playerState.statistics.resourcesBought[type] + '[/color] ' + + g_OutcomeColor + '-' + playerState.statistics.resourcesSold[type] + '[/color]'; } function calculateBatteryEfficiency(playerState, position) { var totalBought = 0; - for each (var boughtAmount in playerState.statistics.resourcesBought) + for each (let boughtAmount in playerState.statistics.resourcesBought) totalBought += boughtAmount; var totalSold = 0; - for each (var soldAmount in playerState.statistics.resourcesSold) + for each (let soldAmount in playerState.statistics.resourcesSold) totalSold += soldAmount; return Math.floor(totalSold > 0 ? (totalBought / totalSold) * 100 : 0) + "%"; @@ -214,12 +215,12 @@ function calculateTradeIncome(playerState, position) function calculateMarketTeam(counters) { - for (var t in g_Teams) + for (let t in g_Teams) { if (t == -1) continue; - for (var w in counters) + for (let w in counters) { var teamTotal = "undefined"; @@ -227,7 +228,7 @@ function calculateMarketTeam(counters) i : 0, o : 0 }; - for (var p = 0; p < g_Teams[t]; ++p) + for (let p = 0; p < g_Teams[t]; ++p) { var caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption; // clean [Color=""], [/Color], white space, + and % for make the sum more easy @@ -246,7 +247,7 @@ function calculateMarketTeam(counters) if (w >= 4) teamTotal = total.i +(w == 4 ? "%" : ""); else - teamTotal = INCOME_COLOR + '+' + total.i + '[/color] ' + OUTCOME_COLOR + '-' + total.o + '[/color]'; + teamTotal = g_IncomeColor + '+' + total.i + '[/color] ' + g_IncomeColor + '-' + total.o + '[/color]'; Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; } @@ -298,9 +299,9 @@ function calculateKillDeathRatio(playerState, position) teamMiscHelperData[playerState.team][position].unitsLost = playerState.statistics.unitsLost.total; if (!playerState.statistics.enemyUnitsKilled.total) - return DEFAULT_DECIMAL; + return g_DefaultDecimal if (!playerState.statistics.unitsLost.total) // and enemyUnitsKilled.total > 0 - return INFINITE_SYMBOL; // infinity symbol + return g_InfiniteSymbol; // infinity symbol return Math.round((playerState.statistics.enemyUnitsKilled.total / playerState.statistics.unitsLost.total)*100)/100; } @@ -334,12 +335,12 @@ function calculateMapPeakControl(playerState, position) function calculateMiscellaneous(counters) { - for (var t in g_Teams) + for (let t in g_Teams) { if (t == -1) continue; - for (var w in counters) + for (let w in counters) { var teamTotal = "undefined"; @@ -350,9 +351,9 @@ function calculateMiscellaneous(counters) else if (w == 2) { if (!teamMiscHelperData[t][w].enemyUnitsKilled) - teamTotal = DEFAULT_DECIMAL; + teamTotal = g_DefaultDecimal; else if (!teamMiscHelperData[t][w].unitsLost) // and enemyUnitsKilled.total > 0 - teamTotal = INFINITE_SYMBOL; // infinity symbol + teamTotal = g_InfiniteSymbol; // infinity symbol else teamTotal = Math.round((teamMiscHelperData[t][w].enemyUnitsKilled / teamMiscHelperData[t][w].unitsLost)*100)/100; } diff --git a/binaries/data/mods/public/gui/summary/layout.js b/binaries/data/mods/public/gui/summary/layout.js index 00e5ab5718..8ac690564c 100644 --- a/binaries/data/mods/public/gui/summary/layout.js +++ b/binaries/data/mods/public/gui/summary/layout.js @@ -16,7 +16,7 @@ var panelsData = [ ], "teamCounterFn": calculateScoreTeam }, - { // buildings panel + { // buildings panel "headings": [ // headings on buildings panel { "caption": translate("Player name"), "yStart": 26, "width": 200 }, { "caption": translate("Total"), "yStart": 34, "width": 105 }, @@ -32,14 +32,14 @@ var panelsData = [ { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed)"), "yStart": 16, "width": (85 * 7 + 105) }, // width = 700 ], "counters": [ // counters on buildings panel - {"width": 105, "fn": calculateBuildings}, - {"width": 85, "fn": calculateBuildings}, - {"width": 85, "fn": calculateBuildings}, - {"width": 85, "fn": calculateBuildings}, - {"width": 85, "fn": calculateBuildings}, - {"width": 85, "fn": calculateBuildings}, - {"width": 85, "fn": calculateBuildings}, - {"width": 85, "fn": calculateBuildings} + { "width": 105, "fn": calculateBuildings }, + { "width": 85, "fn": calculateBuildings }, + { "width": 85, "fn": calculateBuildings }, + { "width": 85, "fn": calculateBuildings }, + { "width": 85, "fn": calculateBuildings }, + { "width": 85, "fn": calculateBuildings }, + { "width": 85, "fn": calculateBuildings }, + { "width": 85, "fn": calculateBuildings } ], "teamCounterFn": calculateColorsTeam }, @@ -59,14 +59,14 @@ var panelsData = [ { "caption": translate("Units Statistics (Trained / Lost / Killed)"), "yStart": 16, "width": (100 * 7 + 120) }, // width = 820 ], "counters": [ // counters on units panel - {"width": 120, "fn": calculateUnits}, - {"width": 100, "fn": calculateUnits}, - {"width": 100, "fn": calculateUnits}, - {"width": 100, "fn": calculateUnits}, - {"width": 100, "fn": calculateUnits}, - {"width": 100, "fn": calculateUnits}, - {"width": 100, "fn": calculateUnits}, - {"width": 100, "fn": calculateUnits} + { "width": 120, "fn": calculateUnits }, + { "width": 100, "fn": calculateUnits }, + { "width": 100, "fn": calculateUnits }, + { "width": 100, "fn": calculateUnits }, + { "width": 100, "fn": calculateUnits }, + { "width": 100, "fn": calculateUnits }, + { "width": 100, "fn": calculateUnits }, + { "width": 100, "fn": calculateUnits } ], "teamCounterFn": calculateColorsTeam }, @@ -86,14 +86,14 @@ var panelsData = [ { "caption": translate("Resource Statistics (Gathered / Used)"), "yStart": 16, "width": (100 * 4 + 110) }, // width = 510 ], "counters": [ // counters on resources panel - {"width": 100, "fn": calculateResources}, - {"width": 100, "fn": calculateResources}, - {"width": 100, "fn": calculateResources}, - {"width": 100, "fn": calculateResources}, - {"width": 110, "fn": calculateTotalResources}, - {"width": 121, "fn": calculateTributeSent}, - {"width": 100, "fn": calculateTreasureCollected}, - {"width": 100, "fn": calculateLootCollected} + { "width": 100, "fn": calculateResources }, + { "width": 100, "fn": calculateResources }, + { "width": 100, "fn": calculateResources }, + { "width": 100, "fn": calculateResources }, + { "width": 110, "fn": calculateTotalResources }, + { "width": 121, "fn": calculateTributeSent }, + { "width": 100, "fn": calculateTreasureCollected }, + { "width": 100, "fn": calculateLootCollected } ], "teamCounterFn": calculateResourcesTeam }, @@ -109,12 +109,12 @@ var panelsData = [ ], "titleHeadings": [], "counters": [ // counters on market panel - {"width": 100, "fn": calculateResourceExchanged}, - {"width": 100, "fn": calculateResourceExchanged}, - {"width": 100, "fn": calculateResourceExchanged}, - {"width": 100, "fn": calculateResourceExchanged}, - {"width": 100, "fn": calculateBatteryEfficiency}, - {"width": 100, "fn": calculateTradeIncome} + { "width": 100, "fn": calculateResourceExchanged }, + { "width": 100, "fn": calculateResourceExchanged }, + { "width": 100, "fn": calculateResourceExchanged }, + { "width": 100, "fn": calculateResourceExchanged }, + { "width": 100, "fn": calculateBatteryEfficiency }, + { "width": 100, "fn": calculateTradeIncome } ], "teamCounterFn": calculateMarketTeam }, @@ -132,12 +132,12 @@ var panelsData = [ { "caption": translate("Map control"), "xOffset": 400, "yStart": 16, "width": 200 } ], "counters": [ // counters on miscellaneous panel - {"width": 100, "fn": calculateVegetarianRatio}, - {"width": 100, "fn": calculateFeminization}, - {"width": 100, "fn": calculateKillDeathRatio}, - {"width": 100, "fn": calculateMapExploration}, - {"width": 100, "fn": calculateMapPeakControl}, - {"width": 100, "fn": calculateMapFinalControl} + { "width": 100, "fn": calculateVegetarianRatio }, + { "width": 100, "fn": calculateFeminization }, + { "width": 100, "fn": calculateKillDeathRatio }, + { "width": 100, "fn": calculateMapExploration }, + { "width": 100, "fn": calculateMapPeakControl }, + { "width": 100, "fn": calculateMapFinalControl } ], "teamCounterFn": calculateMiscellaneous } @@ -145,7 +145,7 @@ var panelsData = [ function resetGeneralPanel() { - for (var h = 0; h < MAX_HEADINGTITLE; ++h) + for (var h = 0; h < g_MaxHeadingTitle; ++h) { Engine.GetGUIObjectByName("titleHeading["+ h +"]").hidden = true; Engine.GetGUIObjectByName("Heading[" + h + "]").hidden = true; @@ -164,7 +164,7 @@ function resetGeneralPanel() function updateGeneralPanelHeadings(headings) { var left = 50; - for (var h in headings) + for (let h in headings) { var headerGUIName = "playerNameHeading"; if (h > 0) @@ -175,7 +175,7 @@ function updateGeneralPanelHeadings(headings) headerGUI.size = left + " " + headings[h].yStart + " " + (left + headings[h].width) + " 100%"; headerGUI.hidden = false; - if (headings[h].width < LONG_HEADING_WIDTH) + if (headings[h].width < g_LongHeadingWidth) left += headings[h].width; } } @@ -183,9 +183,9 @@ function updateGeneralPanelHeadings(headings) function updateGeneralPanelTitles(titleHeadings) { var left = 250; - for (var th in titleHeadings) + for (let th in titleHeadings) { - if (th >= MAX_HEADINGTITLE) + if (th >= g_MaxHeadingTitle) break; if (titleHeadings[th].xOffset) @@ -196,7 +196,7 @@ function updateGeneralPanelTitles(titleHeadings) headerGUI.size = left + " " + titleHeadings[th].yStart + " " + (left + titleHeadings[th].width) + " 100%"; headerGUI.hidden = false; - if (titleHeadings[th].width < LONG_HEADING_WIDTH) + if (titleHeadings[th].width < g_LongHeadingWidth) left += titleHeadings[th].width; } } @@ -209,7 +209,7 @@ function updateGeneralPanelCounter(counters) { left = 240; var counterObject; - for (var w in counters) + for (let w in counters) { counterObject = Engine.GetGUIObjectByName("valueData[" + p + "][" + w + "]"); counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%"; @@ -223,7 +223,7 @@ function updateGeneralPanelCounter(counters) for (let t = 0; t < g_MaxTeams; ++t) { left = 240; - for (var w in counters) + for (let w in counters) { counterObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]"); counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%"; @@ -231,7 +231,7 @@ function updateGeneralPanelCounter(counters) if (g_Teams[t]) { - var yStart = 30 + g_Teams[t] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 2; + var yStart = 30 + g_Teams[t] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 2; counterTotalObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]"); counterTotalObject.size = (left + 20) + " " + yStart + " " + (left + counters[w].width) + " 100%"; counterTotalObject.hidden = false; @@ -252,8 +252,8 @@ function updateGeneralPanelTeams() if (!g_Teams) return; - var yStart = TEAMS_BOX_Y_START + g_WithoutTeam * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP); - for (var i = 0; i < g_Teams.length; ++i) + var yStart = g_TeamsBoxYStart + g_WithoutTeam * (g_PlayerBoxYSize + g_PlayerBoxGap); + for (let i = 0; i < g_Teams.length; ++i) { if (!g_Teams[i]) continue; @@ -264,12 +264,12 @@ function updateGeneralPanelTeams() teamBoxSize.top = yStart; teamBox.size = teamBoxSize; - yStart += 30 + g_Teams[i] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 32; + yStart += 30 + g_Teams[i] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 32; Engine.GetGUIObjectByName("teamNameHeadingt["+i+"]").caption = "Team "+(i+1); var teamHeading = Engine.GetGUIObjectByName("teamHeadingt["+i+"]"); - var yStartTotal = 30 + g_Teams[i] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 2; + var yStartTotal = 30 + g_Teams[i] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 2; teamHeading.size = "50 "+yStartTotal+" 100% "+(yStartTotal+20); teamHeading.caption = translate("Team total"); } @@ -284,16 +284,16 @@ function updateObjectPlayerPosition() { var playerBox = Engine.GetGUIObjectByName("playerBox[" + h + "]"); var boxSize = playerBox.size; - boxSize.top += h * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP); - boxSize.bottom = boxSize.top + PLAYER_BOX_Y_SIZE; + boxSize.top += h * (g_PlayerBoxYSize + g_PlayerBoxGap); + boxSize.bottom = boxSize.top + g_PlayerBoxYSize; playerBox.size = boxSize; for (let i = 0; i < g_MaxTeams; ++i) { var playerBoxt = Engine.GetGUIObjectByName("playerBoxt[" + i + "][" + h + "]"); boxSize = playerBoxt.size; - boxSize.top += h * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP); - boxSize.bottom = boxSize.top + PLAYER_BOX_Y_SIZE; + boxSize.top += h * (g_PlayerBoxYSize + g_PlayerBoxGap); + boxSize.bottom = boxSize.top + g_PlayerBoxYSize; playerBoxt.size = boxSize; } } diff --git a/binaries/data/mods/public/gui/summary/summary.js b/binaries/data/mods/public/gui/summary/summary.js index 8b5c7d929c..f0e4efa93c 100644 --- a/binaries/data/mods/public/gui/summary/summary.js +++ b/binaries/data/mods/public/gui/summary/summary.js @@ -1,32 +1,32 @@ -const MAX_HEADINGTITLE = 8; +const g_MaxHeadingTitle= 8; // const for filtering long collective headings -const LONG_HEADING_WIDTH = 250; +const g_LongHeadingWidth = 250; // Vertical size of player box -const PLAYER_BOX_Y_SIZE = 30; +const g_PlayerBoxYSize = 30; // Gap between players boxes -const PLAYER_BOX_GAP = 2; +const g_PlayerBoxGap = 2; // Alpha for player box -const PLAYER_BOX_ALPHA = " 32"; +const g_PlayerBoxAlpha = " 32"; // Alpha for player color box -const PLAYER_COLOR_BOX_ALPHA = " 255"; +const g_PlayerColorBoxAlpha = " 255"; // yStart value for spacing teams boxes (and noTeamsBox) -const TEAMS_BOX_Y_START = 65; +const g_TeamsBoxYStart = 65; // Colors used for units and buildings -const TRAINED_COLOR = '[color="201 255 200"]'; -const LOST_COLOR = '[color="255 213 213"]'; -const KILLED_COLOR = '[color="196 198 255"]'; +const g_TrainedColor = '[color="201 255 200"]'; +const g_LostColor = '[color="255 213 213"]'; +const g_KilledColor = '[color="196 198 255"]'; -const BUILDINGS_TYPES = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ]; -const UNITS_TYPES = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship", "Trader" ]; -const RESOURCES_TYPES = [ "food", "wood", "stone", "metal" ]; +const g_BuildingsTypes = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ]; +const g_UnitsTypes = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship", "Trader" ]; +const g_ResourcesTypes = [ "food", "wood", "stone", "metal" ]; // Colors used for gathered and traded resources -const INCOME_COLOR = '[color="201 255 200"]'; -const OUTCOME_COLOR = '[color="255 213 213"]'; +const g_IncomeColor = '[color="201 255 200"]'; +const g_OutcomeColor = '[color="255 213 213"]'; -const DEFAULT_DECIMAL = "0.00"; -const INFINITE_SYMBOL = "\u221E"; +const g_DefaultDecimal = "0.00"; +const g_InfiniteSymbol = "\u221E"; // Load data var g_CivData = loadCivData(); var g_Teams = []; @@ -52,7 +52,7 @@ function selectPanel(panelNumber) rightSpacer.size = (tabSize.right - 2) + " " + rightSpacer.size.top + " 100%-20 " + rightSpacer.size.bottom; } - for (var i = 0; i < panelNames.length; ++i) + for (let i = 0; i < panelNames.length; ++i) { Engine.GetGUIObjectByName(panelNames[i] + 'Button').sprite = "BackgroundTab"; } @@ -73,7 +73,7 @@ function updatePanelData(panelInfo) updateGeneralPanelTeams(); var playerBoxesCounts = [ ]; - for (var i = 0; i < g_PlayerCount; ++i) + for (let i = 0; i < g_PlayerCount; ++i) { var playerState = g_GameData.playerStates[i+1]; @@ -104,13 +104,13 @@ function updatePanelData(panelInfo) var rowPlayerObject = Engine.GetGUIObjectByName(rowPlayer); rowPlayerObject.hidden = false; - rowPlayerObject.sprite = colorString + PLAYER_BOX_ALPHA; + rowPlayerObject.sprite = colorString + g_PlayerBoxAlpha; var boxSize = rowPlayerObject.size; boxSize.right = rowPlayerObjectWidth; rowPlayerObject.size = boxSize; var playerColorBox = Engine.GetGUIObjectByName(playerColorBoxColumn); - playerColorBox.sprite = colorString + PLAYER_COLOR_BOX_ALPHA; + playerColorBox.sprite = colorString + g_PlayerColorBoxAlpha; Engine.GetGUIObjectByName(playerNameColumn).caption = g_GameData.players[i+1].name; @@ -144,7 +144,7 @@ function init(data) if (data.mapSettings.LockTeams) // teams ARE locked { // Count teams - for(var t = 0; t < g_PlayerCount; ++t) + for (let t = 0; t < g_PlayerCount; ++t) { let playerTeam = data.playerStates[t+1].team; if (g_Teams[playerTeam]) @@ -162,7 +162,7 @@ function init(data) // Erase teams data if teams are not displayed if (!g_Teams) { - for(var p = 0; p < g_PlayerCount; ++p) + for (let p = 0; p < g_PlayerCount; ++p) data.playerStates[p+1].team = -1; } @@ -170,7 +170,7 @@ function init(data) if (g_Teams) { // Count players without team (or all if teams are not displayed) - for (var i = 0; i < g_Teams.length; ++i) + for (let i = 0; i < g_Teams.length; ++i) g_WithoutTeam -= g_Teams[i] ? g_Teams[i] : 0; }