Ticket #3216: 3216.7.patch
File 3216.7.patch, 16.6 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/summary/counters.js
27 27 function calculateMilitaryScore(playerState, position) 28 28 { 29 29 return Math.round((playerState.statistics.enemyUnitsKilledValue + 30 playerState.statistics.enemyBuildingsDestroyedValue) / 10); 30 playerState.statistics.enemyBuildingsDestroyedValue + 31 playerState.statistics.buildingsCapturedValue) / 10); 31 32 } 32 33 33 34 function calculateExplorationScore(playerState, position) … … 63 64 function calculateBuildings(playerState, position) 64 65 { 65 66 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]'; 67 return ' ' + TRAINED_COLOR + playerState.statistics.buildingsConstructed[type] + '[/color] / ' + 68 KILLED_COLOR + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]\n' + 69 CAPTURED_COLOR + playerState.statistics.buildingsCaptured[type] + '[/color] / ' + 70 LOST_COLOR + playerState.statistics.buildingsLost[type] + '[/color]'; 69 71 } 70 72 71 function calculate ColorsTeam(counters)73 function calculateBuildingsTeam(counters) 72 74 { 73 75 for (var t in g_Teams) 74 76 { … … 78 80 for (var w in counters) 79 81 { 80 82 var total = { 83 constructed : 0, 84 destroyed : 0, 85 captured : 0, 86 lost : 0 87 }; 88 for (var p = 0; p < g_Teams[t]; ++p) 89 { 90 var caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption; 91 // clean [Color=""], [/Color] and white space for make the sum more easy 92 caption = caption.replace(/\[([\w\' \\\"\/\=]*)\]|[\t\r \f]/g, ""); 93 94 var splitCaption = caption.split("\n"); 95 var first = splitCaption[0].split("/"); 96 var second = splitCaption[1].split("/"); 97 98 total.constructed += (+first[0]); 99 total.destroyed += (+first[1]); 100 total.captured += (+second[0]); 101 total.lost += (+second[1]); 102 } 103 var teamTotal = ' ' + TRAINED_COLOR + total.constructed + '[/color] / ' + 104 KILLED_COLOR + total.destroyed + '[/color]\n' + 105 CAPTURED_COLOR + total.captured + '[/color] / ' + 106 LOST_COLOR + total.lost + '[/color]'; 107 108 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; 109 } 110 } 111 } 112 113 function calculateUnitsTeam(counters) 114 { 115 for (var t in g_Teams) 116 { 117 if (t == -1) 118 continue; 119 120 for (var w in counters) 121 { 122 var total = { 81 123 c : 0, 82 124 l : 0, 83 125 d : 0 -
binaries/data/mods/public/gui/summary/layout.js
9 9 ], 10 10 "titleHeadings": [], 11 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 }12 { "width": 100, "fn": calculateEconomyScore, "verticalOffset": 12 }, 13 { "width": 100, "fn": calculateMilitaryScore, "verticalOffset": 12 }, 14 { "width": 100, "fn": calculateExplorationScore, "verticalOffset": 12 }, 15 { "width": 100, "fn": calculateScoreTotal, "verticalOffset": 12 } 16 16 ], 17 17 "teamCounterFn": calculateScoreTeam 18 18 }, … … 29 29 { "caption": translate("Wonders"), "yStart": 34, "width": 85 } 30 30 ], 31 31 "titleHeadings": [ 32 { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed)"), "yStart": 16, "width": (85 * 7 + 105) }, // width = 735 32 { "caption": translate("Buildings Statistics (Constructed / Destroyed / Captured / Lost)"), 33 "yStart": 16, "width": (85 * 7 + 105) 34 }, // width = 735 33 35 ], 34 36 "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 }37 {"width": 105, "fn": calculateBuildings, "verticalOffset": 3}, 38 {"width": 85, "fn": calculateBuildings, "verticalOffset": 3}, 39 {"width": 85, "fn": calculateBuildings, "verticalOffset": 3}, 40 {"width": 85, "fn": calculateBuildings, "verticalOffset": 3}, 41 {"width": 85, "fn": calculateBuildings, "verticalOffset": 3}, 42 {"width": 85, "fn": calculateBuildings, "verticalOffset": 3}, 43 {"width": 85, "fn": calculateBuildings, "verticalOffset": 3}, 44 {"width": 85, "fn": calculateBuildings, "verticalOffset": 3} 43 45 ], 44 "teamCounterFn": calculate ColorsTeam46 "teamCounterFn": calculateBuildingsTeam 45 47 }, 46 48 { // units panel 47 49 "headings": [ // headings on units panel … … 58 60 { "caption": translate("Units Statistics (Trained / Lost / Killed)"), "yStart": 16, "width": (100 * 6 + 120) }, // width = 720 59 61 ], 60 62 "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 }63 {"width": 120, "fn": calculateUnits, "verticalOffset": 12}, 64 {"width": 100, "fn": calculateUnits, "verticalOffset": 12}, 65 {"width": 100, "fn": calculateUnits, "verticalOffset": 12}, 66 {"width": 100, "fn": calculateUnits, "verticalOffset": 12}, 67 {"width": 100, "fn": calculateUnits, "verticalOffset": 12}, 68 {"width": 100, "fn": calculateUnits, "verticalOffset": 12}, 69 {"width": 100, "fn": calculateUnits, "verticalOffset": 12} 68 70 ], 69 "teamCounterFn": calculate ColorsTeam71 "teamCounterFn": calculateUnitsTeam 70 72 }, 71 73 { // resources panel 72 74 "headings": [ // headings on resources panel … … 83 85 { "caption": translate("Resource Statistics (Gathered / Used)"), "yStart": 16, "width": (100 * 4 + 110) }, // width = 510 84 86 ], 85 87 "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 }88 {"width": 100, "fn": calculateResources, "verticalOffset": 12}, 89 {"width": 100, "fn": calculateResources, "verticalOffset": 12}, 90 {"width": 100, "fn": calculateResources, "verticalOffset": 12}, 91 {"width": 100, "fn": calculateResources, "verticalOffset": 12}, 92 {"width": 110, "fn": calculateTotalResources, "verticalOffset": 12}, 93 {"width": 100, "fn": calculateTreasureCollected, "verticalOffset": 12}, 94 {"width": 121, "fn": calculateTributeSent, "verticalOffset": 12} 93 95 ], 94 96 "teamCounterFn": calculateResourcesTeam 95 97 }, … … 105 107 ], 106 108 "titleHeadings": [], 107 109 "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 }110 {"width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12}, 111 {"width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12}, 112 {"width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12}, 113 {"width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12}, 114 {"width": 100, "fn": calculateBatteryEfficiency, "verticalOffset": 12}, 115 {"width": 100, "fn": calculateTradeIncome, "verticalOffset": 12} 114 116 ], 115 117 "teamCounterFn": calculateMarketTeam 116 118 }, … … 124 126 ], 125 127 "titleHeadings": [], 126 128 "counters": [ // counters on miscellaneous panel 127 {"width": 100, "fn": calculateVegetarianRatio },128 {"width": 100, "fn": calculateFeminisation },129 {"width": 100, "fn": calculateKillDeathRatio },130 {"width": 100, "fn": calculateMapExploration }129 {"width": 100, "fn": calculateVegetarianRatio, "verticalOffset": 12}, 130 {"width": 100, "fn": calculateFeminisation, "verticalOffset": 12}, 131 {"width": 100, "fn": calculateKillDeathRatio, "verticalOffset": 12}, 132 {"width": 100, "fn": calculateMapExploration, "verticalOffset": 12} 131 133 ], 132 134 "teamCounterFn": calculateMiscellaneous 133 135 } … … 189 191 { 190 192 var rowPlayerObjectWidth = 0; 191 193 var left = 0; 194 192 195 for (var p = 0; p < MAX_SLOTS; ++p) 193 196 { 194 197 left = 240; … … 196 199 for (var w in counters) 197 200 { 198 201 counterObject = Engine.GetGUIObjectByName("valueData[" + p + "][" + w + "]"); 199 counterObject.size = left + " 6" + (left + counters[w].width) + " 100%";202 counterObject.size = left + " " + counters[w].verticalOffset + " " + (left + counters[w].width) + " 100%"; 200 203 counterObject.hidden = false; 201 204 left += counters[w].width; 202 205 } … … 210 213 for (var w in counters) 211 214 { 212 215 counterObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]"); 213 counterObject.size = left + " 6" + (left + counters[w].width) + " 100%";216 counterObject.size = left + " " + counters[w].verticalOffset + " " + (left + counters[w].width) + " 100%"; 214 217 counterObject.hidden = false; 215 218 216 219 if (g_Teams[t]) 217 220 { 218 var yStart = 30 + g_Teams[t] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 2;221 var yStart = 25 + g_Teams[t] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 3 + counters[w].verticalOffset; 219 222 counterTotalObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]"); 220 223 counterTotalObject.size = (left + 20) + " " + yStart + " " + (left + counters[w].width) + " 100%"; 221 224 counterTotalObject.hidden = false; … … 250 253 Engine.GetGUIObjectByName("teamNameHeadingt["+i+"]").caption = "Team "+(i+1); 251 254 252 255 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);256 var yStartTotal = 30 + g_Teams[i] * (PLAYER_BOX_Y_SIZE + PLAYER_BOX_GAP) + 10; 257 teamHeading.size = "50 " + yStartTotal + " 100% " + (yStartTotal + 20); 255 258 teamHeading.caption = translate("Team total"); 256 259 } 257 260 // If there are no players without team, hide "player name" heading -
binaries/data/mods/public/gui/summary/summary.js
6 6 // const for filtering long collective headings 7 7 const LONG_HEADING_WIDTH = 250; 8 8 // vertical size of player box 9 const PLAYER_BOX_Y_SIZE = 30;9 const PLAYER_BOX_Y_SIZE = 40; 10 10 // gap between players boxes 11 11 const PLAYER_BOX_GAP = 2; 12 12 // alpha for player box … … 14 14 // alpha for player color box 15 15 const PLAYER_COLOR_BOX_ALPHA = " 255"; 16 16 // yStart value for spacing teams boxes (and noTeamsBox) 17 const TEAMS_BOX_Y_START = 65;17 const TEAMS_BOX_Y_START = 40; 18 18 // colors used for units and buildings 19 19 const TRAINED_COLOR = '[color="201 255 200"]'; 20 20 const LOST_COLOR = '[color="255 213 213"]'; 21 21 const KILLED_COLOR = '[color="196 198 255"]'; 22 const CAPTURED_COLOR = '[color="255 255 157"]'; 22 23 23 24 const BUILDINGS_TYPES = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ]; 24 25 const UNITS_TYPES = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship" ]; -
binaries/data/mods/public/gui/summary/summary.xml
119 119 <object size="0 30 100% 100%"> 120 120 <repeat count="8" var="n"> 121 121 <object type="image" name="playerBoxt[i][n]" size="10 0 10 30" hidden="true"> 122 <object name="playerColorBoxt[i][n]" type="image" size="10 4 30 24"/>122 <object name="playerColorBoxt[i][n]" type="image" size="10 9 34 33"/> 123 123 <object name="playerNamet[i][n]" type="text" size="40 2 208 100%" style="ModernLeftLabelText" /> 124 <object name="civIcont[i][n]" type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>124 <object name="civIcont[i][n]" type="image" size="208 5 240 37" tooltip_style="sessionToolTip"/> 125 125 <repeat var="x" count="8"> 126 126 <object name="valueDataTeam[i][n][x]" type="text" style="ModernTabLabelText"> 127 127 </object> … … 140 140 <object type="image" name="noTeamsBox" size="0 65 100% 100%-50" hidden="true"> 141 141 <repeat count="8"> 142 142 <object type="image" name="playerBox[n]" size="10 0 10 30" hidden="true"> 143 <object type="image" sprite="ForegroundBox" size="10 4 34 28">143 <object type="image" sprite="ForegroundBox" size="10 9 34 33"> 144 144 <object name="playerColorBox[n]" type="image" size="2 2 22 22"/> 145 145 </object> 146 146 <object name="playerName[n]" type="text" size="40 2 208 100%" style="ModernLeftLabelText"/> 147 <object name="civIcon[n]" type="image" size="208 0 240 32"/>147 <object name="civIcon[n]" type="image" size="208 5 240 37"/> 148 148 <repeat var="x" count="8"> 149 149 <object name="valueData[n][x]" type="text" style="ModernTabLabelText"> 150 150 </object> -
binaries/data/mods/public/simulation/components/Capturable.js
103 103 for (let i in this.cp) 104 104 if (this.cp[i] >= this.cp[bestPlayer]) 105 105 bestPlayer = +i; 106 107 var cmpLostPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker); 108 if (cmpLostPlayerStatisticsTracker) 109 cmpLostPlayerStatisticsTracker.LostEntity(this.entity); 106 110 107 111 cmpOwnership.SetOwner(bestPlayer); 108 112 113 var cmpCapturedPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker); 114 if (cmpCapturedPlayerStatisticsTracker) 115 cmpCapturedPlayerStatisticsTracker.CapturedBuilding(this.entity); 116 109 117 return takenCp; 110 118 }; 111 119 -
binaries/data/mods/public/simulation/components/StatisticsTracker.js
76 76 "CivCentre": 0, 77 77 "Wonder": 0, 78 78 "total": 0 79 79 }; 80 80 this.buildingsLostValue = 0; 81 81 this.enemyBuildingsDestroyed = { 82 82 "House": 0, … … 87 87 "CivCentre": 0, 88 88 "Wonder": 0, 89 89 "total": 0 90 }; 91 this.enemyBuildingsDestroyedValue = 0; 90 }; 91 this.enemyBuildingsDestroyedValue = 0; 92 this.buildingsCaptured = { 93 "House": 0, 94 "Economic": 0, 95 "Outpost": 0, 96 "Military": 0, 97 "Fortress": 0, 98 "CivCentre": 0, 99 "Wonder": 0, 100 "total": 0 101 }; 102 this.buildingsCapturedValue = 0; 92 103 // resources 93 104 this.resourcesGathered = { 94 105 "food": 0, … … 149 160 "buildingsLost": this.buildingsLost, 150 161 "buildingsLostValue": this.buildingsLostValue, 151 162 "enemyBuildingsDestroyed": this.enemyBuildingsDestroyed, 152 "enemyBuildingsDestroyedValue": this.enemyBuildingsDestroyedValue, 163 "enemyBuildingsDestroyedValue": this.enemyBuildingsDestroyedValue, 164 "buildingsCaptured": this.buildingsCaptured, 165 "buildingsCapturedValue": this.buildingsCapturedValue, 153 166 "resourcesGathered": this.resourcesGathered, 154 167 "resourcesUsed": this.resourcesUsed, 155 168 "resourcesSold": this.resourcesSold, … … 292 305 for each (var cost in costs) 293 306 this.buildingsLostValue += cost; 294 307 } 308 }; 309 310 StatisticsTracker.prototype.CapturedBuilding = function(capturedBuilding) 311 { 312 var cmpCapturedBuildingIdentity = Engine.QueryInterface(capturedBuilding, IID_Identity); 313 var cmpCost = Engine.QueryInterface(capturedBuilding, IID_Cost); 314 var costs = cmpCost.GetResourceCosts(); 315 316 for each (var type in this.buildingsClasses) 317 this.CounterIncrement(cmpCapturedBuildingIdentity, "buildingsCaptured", type); 318 319 this.buildingsCaptured.total++; 320 321 for each (var cost in costs) 322 this.buildingsCapturedValue += cost; 295 323 }; 296 324 297 325 /**