Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/summary/layout.js
var g_ScorePanelsData = { | var g_ScorePanelsData = { | ||||
"score": { | "score": { | ||||
"caption": translate("Score"), | |||||
"headings": [ | "headings": [ | ||||
{ "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "caption": translate("Economy score"), "yStart": 16, "width": 100 }, | { "identifier": "economyScore", "caption": translate("Economy score"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Military score"), "yStart": 16, "width": 100 }, | { "identifier": "militaryScore", "caption": translate("Military score"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Exploration score"), "yStart": 16, "width": 100 }, | { "identifier": "explorationScore", "caption": translate("Exploration score"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Total score"), "yStart": 16, "width": 100 } | { "identifier": "totalScore", "caption": translate("Total score"), "yStart": 16, "width": 100 } | ||||
], | ], | ||||
"titleHeadings": [], | "titleHeadings": [], | ||||
"counters": [ | "counters": [ | ||||
{ "width": 100, "fn": calculateEconomyScore, "verticalOffset": 12 }, | { "width": 100, "fn": calculateEconomyScore, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateMilitaryScore, "verticalOffset": 12 }, | { "width": 100, "fn": calculateMilitaryScore, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateExplorationScore, "verticalOffset": 12 }, | { "width": 100, "fn": calculateExplorationScore, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateScoreTotal, "verticalOffset": 12 } | { "width": 100, "fn": calculateScoreTotal, "verticalOffset": 12 } | ||||
], | ], | ||||
"teamCounterFn": calculateScoreTeam | "teamCounterFn": calculateScoreTeam | ||||
}, | }, | ||||
"buildings": { | "buildings": { | ||||
"caption": translate("Buildings"), | |||||
"headings": [ | "headings": [ | ||||
{ "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "caption": translate("Total"), "yStart": 34, "width": 105 }, | { "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 105 }, | ||||
{ "caption": translate("Houses"), "yStart": 34, "width": 85 }, | { "identifier": "House", "caption": translate("Houses"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Economic"), "yStart": 34, "width": 85 }, | { "identifier": "Economic", "caption": translate("Economic"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Outposts"), "yStart": 34, "width": 85 }, | { "identifier": "Outpost", "caption": translate("Outposts"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Military"), "yStart": 34, "width": 85 }, | { "identifier": "Military", "caption": translate("Military"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Fortresses"), "yStart": 34, "width": 85 }, | { "identifier": "Fortress", "caption": translate("Fortresses"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Civ centers"), "yStart": 34, "width": 85 }, | { "identifier": "CivCentre", "caption": translate("Civ centers"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Wonders"), "yStart": 34, "width": 85 } | { "identifier": "Wonder", "caption": translate("Wonders"), "yStart": 34, "width": 85 } | ||||
], | ], | ||||
"titleHeadings": [ | "titleHeadings": [ | ||||
{ | { | ||||
"caption": sprintf(translate("Buildings Statistics (%(constructed)s / %(destroyed)s / %(captured)s / %(lost)s)"), | "caption": sprintf(translate("Buildings Statistics (%(constructed)s / %(destroyed)s / %(captured)s / %(lost)s)"), | ||||
{ | { | ||||
"constructed": g_TrainedColor + translate("Constructed") + '[/color]', | "constructed": getColoredTypeTranslation("constructed"), | ||||
"destroyed": g_KilledColor + translate("Destroyed") + '[/color]', | "destroyed": getColoredTypeTranslation("destroyed"), | ||||
"captured": g_CapturedColor + translate("Captured") + '[/color]', | "captured": getColoredTypeTranslation("captured"), | ||||
"lost": g_LostColor + translate("Lost") + '[/color]' | "lost": getColoredTypeTranslation("lost") | ||||
}), | }), | ||||
"yStart": 16, | "yStart": 16, | ||||
"width": (85 * 7 + 105) | "width": 85 * 7 + 105 | ||||
}, // width = 700 | }, // width = 700 | ||||
], | ], | ||||
"counters": [ | "counters": [ | ||||
{ "width": 105, "fn": calculateBuildings, "verticalOffset": 3 }, | { "width": 105, "fn": calculateBuildings, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateBuildings, "verticalOffset": 3 } | { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 } | ||||
], | ], | ||||
"teamCounterFn": calculateBuildingsTeam | "teamCounterFn": calculateBuildingsTeam | ||||
}, | }, | ||||
"units": { | "units": { | ||||
"caption": translate("Units"), | |||||
"headings": [ | "headings": [ | ||||
{ "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "caption": translate("Total"), "yStart": 34, "width": 105 }, | { "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 105 }, | ||||
{ "caption": translate("Infantry"), "yStart": 34, "width": 85 }, | { "identifier": "Infantry", "caption": translate("Infantry"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Worker"), "yStart": 34, "width": 85 }, | { "identifier": "Worker", "caption": translate("Worker"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Cavalry"), "yStart": 34, "width": 85 }, | { "identifier": "Cavalry", "caption": translate("Cavalry"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Champion"), "yStart": 34, "width": 85 }, | { "identifier": "Champion", "caption": translate("Champion"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Heroes"), "yStart": 34, "width": 85 }, | { "identifier": "Hero", "caption": translate("Heroes"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Siege"), "yStart": 34, "width": 85 }, | { "identifier": "Siege", "caption": translate("Siege"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Navy"), "yStart": 34, "width": 85 }, | { "identifier": "Ship", "caption": translate("Navy"), "yStart": 34, "width": 85 }, | ||||
{ "caption": translate("Traders"), "yStart": 34, "width": 85 } | { "identifier": "Trader", "caption": translate("Traders"), "yStart": 34, "width": 85 } | ||||
], | ], | ||||
"titleHeadings": [ | "titleHeadings": [ | ||||
{ | { | ||||
"caption": sprintf(translate("Units Statistics (%(trained)s / %(killed)s / %(captured)s / %(lost)s)"), | "caption": sprintf(translate("Units Statistics (%(trained)s / %(killed)s / %(captured)s / %(lost)s)"), | ||||
{ | { | ||||
"trained": g_TrainedColor + translate("Trained") + '[/color]', | "trained": getColoredTypeTranslation("trained"), | ||||
"killed": g_KilledColor + translate("Killed") + '[/color]', | "killed": getColoredTypeTranslation("killed"), | ||||
"captured": g_CapturedColor + translate("Captured") + '[/color]', | "captured": getColoredTypeTranslation("captured"), | ||||
"lost": g_LostColor + translate("Lost") + '[/color]' | "lost": getColoredTypeTranslation("lost") | ||||
}), | }), | ||||
"yStart": 16, | "yStart": 16, | ||||
"width": (100 * 7 + 120) | "width": 85 * 8 + 105 | ||||
}, // width = 820 | }, // width = 785 | ||||
], | ], | ||||
"counters": [ | "counters": [ | ||||
{ "width": 105, "fn": calculateUnitsWithCaptured, "verticalOffset": 3 }, | { "width": 105, "fn": calculateUnitsWithCaptured, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 105, "fn": calculateUnitsWithCaptured, "verticalOffset": 3 }, | { "width": 85, "fn": calculateUnitsWithCaptured, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 12 } | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 } | ||||
], | ], | ||||
"teamCounterFn": calculateUnitsTeam | "teamCounterFn": calculateUnitsTeam | ||||
}, | }, | ||||
"resources": { | "resources": { | ||||
"caption": translate("Resources"), | |||||
"headings": [ | "headings": [ | ||||
{ "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
...g_ResourceData.GetResources().map(res => ({ | ...g_ResourceData.GetResources().map(res => ({ | ||||
"identifier": res.code, | |||||
"caption": translateWithContext("firstWord", res.name), | "caption": translateWithContext("firstWord", res.name), | ||||
"yStart": 34, | "yStart": 34, | ||||
"width": 100 | "width": 100 | ||||
})), | })), | ||||
{ "caption": translate("Total"), "yStart": 34, "width": 110 }, | { "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 110 }, | ||||
{ | { | ||||
"identifier": "tributes", | |||||
"caption": sprintf(translate("Tributes \n(%(sent)s / %(received)s)"), | "caption": sprintf(translate("Tributes \n(%(sent)s / %(received)s)"), | ||||
{ | { | ||||
"sent": g_IncomeColor + translate("Sent") + '[/color]', | "sent": getColoredTypeTranslation("sent"), | ||||
"received": g_OutcomeColor + translate("Received") + '[/color]' | "received": getColoredTypeTranslation("received") | ||||
}), | }), | ||||
"yStart": 16, | "yStart": 16, | ||||
"width": 121 | "width": 121 | ||||
}, | }, | ||||
{ "caption": translate("Treasures collected"), "yStart": 16, "width": 100 }, | { "identifier": "treasuresCollected", "caption": translate("Treasures collected"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Loot"), "yStart": 16, "width": 100 } | { "identifier": "loot", "caption": translate("Loot"), "yStart": 16, "width": 100 } | ||||
], | ], | ||||
"titleHeadings": [ | "titleHeadings": [ | ||||
{ | { | ||||
"caption": sprintf(translate("Resource Statistics (%(gathered)s / %(used)s)"), | "caption": sprintf(translate("Resource Statistics (%(gathered)s / %(used)s)"), | ||||
{ | { | ||||
"gathered": g_IncomeColor + translate("Gathered") + '[/color]', | "gathered": getColoredTypeTranslation("gathered"), | ||||
"used": g_OutcomeColor + translate("Used") + '[/color]' | "used": getColoredTypeTranslation("used") | ||||
}), | }), | ||||
"yStart": 16, | "yStart": 16, | ||||
"width": 100 * g_ResourceData.GetCodes().length + 110 | "width": 100 * g_ResourceData.GetCodes().length + 110 | ||||
}, | }, | ||||
], | ], | ||||
"counters": [ | "counters": [ | ||||
...g_ResourceData.GetCodes().map(code => ({ | ...g_ResourceData.GetCodes().map(code => ({ | ||||
"fn": calculateResources, | "fn": calculateResources, | ||||
"verticalOffset": 12, | "verticalOffset": 12, | ||||
"width": 100 | "width": 100 | ||||
})), | })), | ||||
{ "width": 110, "fn": calculateTotalResources, "verticalOffset": 12 }, | { "width": 110, "fn": calculateTotalResources, "verticalOffset": 12 }, | ||||
{ "width": 121, "fn": calculateTributeSent, "verticalOffset": 12 }, | { "width": 121, "fn": calculateTributeSent, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateTreasureCollected, "verticalOffset": 12 }, | { "width": 100, "fn": calculateTreasureCollected, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateLootCollected, "verticalOffset": 12 } | { "width": 100, "fn": calculateLootCollected, "verticalOffset": 12 } | ||||
], | ], | ||||
"teamCounterFn": calculateResourcesTeam | "teamCounterFn": calculateResourcesTeam | ||||
}, | }, | ||||
"market": { | "market": { | ||||
"caption": translate("Market"), | |||||
"headings": [ | "headings": [ | ||||
{ "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
...g_ResourceData.GetResources().map(res => { | ...g_ResourceData.GetResources().map(res => { | ||||
return { | return { | ||||
"identifier": res.code, | |||||
"caption": | "caption": | ||||
// Translation: use %(resourceWithinSentence)s if needed | // Translation: use %(resourceWithinSentence)s if needed | ||||
sprintf(translate("%(resourceFirstWord)s exchanged"), { | sprintf(translate("%(resourceFirstWord)s exchanged"), { | ||||
"resourceFirstWord": translateWithContext("firstWord", res.name), | "resourceFirstWord": translateWithContext("firstWord", res.name), | ||||
"resourceWithinSentence": translateWithContext("withinSentence", res.name) | "resourceWithinSentence": translateWithContext("withinSentence", res.name) | ||||
}), | }), | ||||
"yStart": 16, | "yStart": 16, | ||||
"width": 100 | "width": 100 | ||||
}; | }; | ||||
}), | }), | ||||
{ "caption": translate("Barter efficiency"), "yStart": 16, "width": 100 }, | { "identifier": "barterEfficency", "caption": translate("Barter efficiency"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Trade income"), "yStart": 16, "width": 100 } | { "identifier": "tradeIncome", "caption": translate("Trade income"), "yStart": 16, "width": 100 } | ||||
], | ], | ||||
"titleHeadings": [], | "titleHeadings": [], | ||||
"counters": [ | "counters": [ | ||||
...g_ResourceData.GetCodes().map(code => ({ | ...g_ResourceData.GetCodes().map(code => ({ | ||||
"width": 100, | "width": 100, | ||||
"fn": calculateResourceExchanged, | "fn": calculateResourceExchanged, | ||||
"verticalOffset": 12 | "verticalOffset": 12 | ||||
})), | })), | ||||
{ "width": 100, "fn": calculateBarterEfficiency, "verticalOffset": 12 }, | { "width": 100, "fn": calculateBarterEfficiency, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateTradeIncome, "verticalOffset": 12 } | { "width": 100, "fn": calculateTradeIncome, "verticalOffset": 12 } | ||||
], | ], | ||||
"teamCounterFn": calculateMarketTeam | "teamCounterFn": calculateMarketTeam | ||||
}, | }, | ||||
"misc": { | "misc": { | ||||
"caption": translate("Miscellaneous"), | |||||
"headings": [ | "headings": [ | ||||
{ "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "caption": translate("Vegetarian\nratio"), "yStart": 16, "width": 100 }, | { "identifier": "vegetarianRatio", "caption": translate("Vegetarian ratio"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Feminization"), "yStart": 16, "width": 100 }, | { "identifier": "feminization", "caption": translate("Feminization"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Kill / Death\nratio"), "yStart": 16, "width": 100 }, | { "identifier": "killDeath", "caption": translate("Kill / Death ratio"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("Map\nexploration"), "yStart": 16, "width": 100 }, | { "identifier": "mapExploration", "caption": translate("Map exploration"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("At peak"), "yStart": 34, "width": 100 }, | { "identifier": "mapControlPeak", "caption": translate("Map control (peak)"), "yStart": 16, "width": 100 }, | ||||
{ "caption": translate("At finish"), "yStart": 34, "width": 100 } | { "identifier": "mapControlFinish", "caption": translate("Map control (finish)"), "yStart": 16, "width": 100 } | ||||
], | |||||
"titleHeadings": [ | |||||
{ "caption": translate("Map control"), "xOffset": 400, "yStart": 16, "width": 200 } | |||||
], | ], | ||||
"titleHeadings": [], | |||||
"counters": [ | "counters": [ | ||||
{ "width": 100, "fn": calculateVegetarianRatio, "verticalOffset": 12 }, | { "width": 100, "fn": calculateVegetarianRatio, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateFeminization, "verticalOffset": 12 }, | { "width": 100, "fn": calculateFeminization, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateKillDeathRatio, "verticalOffset": 12 }, | { "width": 100, "fn": calculateKillDeathRatio, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateMapExploration, "verticalOffset": 12 }, | { "width": 100, "fn": calculateMapExploration, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateMapPeakControl, "verticalOffset": 12 }, | { "width": 100, "fn": calculateMapPeakControl, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateMapFinalControl, "verticalOffset": 12 } | { "width": 100, "fn": calculateMapFinalControl, "verticalOffset": 12 } | ||||
], | ], | ||||
"teamCounterFn": calculateMiscellaneous | "teamCounterFn": calculateMiscellaneousTeam | ||||
} | } | ||||
}; | }; | ||||
function getColoredTypeTranslation(type) | |||||
{ | |||||
return g_SummaryTypes[type].color ? '[color="' + g_SummaryTypes[type].color + '"]' + g_SummaryTypes[type].caption + '[/color]' : g_SummaryTypes[type].caption; | |||||
} | |||||
function resetGeneralPanel() | function resetGeneralPanel() | ||||
{ | { | ||||
for (let h = 0; h < g_MaxHeadingTitle; ++h) | for (let h = 0; h < g_MaxHeadingTitle; ++h) | ||||
{ | { | ||||
Engine.GetGUIObjectByName("titleHeading["+ h +"]").hidden = true; | Engine.GetGUIObjectByName("titleHeading["+ h +"]").hidden = true; | ||||
Engine.GetGUIObjectByName("Heading[" + h + "]").hidden = true; | Engine.GetGUIObjectByName("Heading[" + h + "]").hidden = true; | ||||
for (let p = 0; p < g_MaxPlayers; ++p) | for (let p = 0; p < g_MaxPlayers; ++p) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator