Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/summary/layout.js
var getScorePanelsData = () => ({ | /** | ||||
"score": { | * Horizontal size of a tab button. | ||||
"caption": translate("Score"), | */ | ||||
var g_TabButtonWidth = 118; | |||||
/** | |||||
* Horizontal space between two tab buttons. | |||||
*/ | |||||
var g_TabButtonDist = 6; | |||||
var getScorePanelsData = () => [ | |||||
{ | |||||
"label": translate("Score"), | |||||
"headings": [ | "headings": [ | ||||
{ "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "identifier": "totalScore", "caption": translate("Total score"), "yStart": 16, "width": 100 }, | { "identifier": "totalScore", "caption": translate("Total score"), "yStart": 16, "width": 100 }, | ||||
{ "identifier": "economyScore", "caption": translate("Economy score"), "yStart": 16, "width": 100 }, | { "identifier": "economyScore", "caption": translate("Economy score"), "yStart": 16, "width": 100 }, | ||||
{ "identifier": "militaryScore", "caption": translate("Military score"), "yStart": 16, "width": 100 }, | { "identifier": "militaryScore", "caption": translate("Military score"), "yStart": 16, "width": 100 }, | ||||
{ "identifier": "explorationScore", "caption": translate("Exploration score"), "yStart": 16, "width": 100 } | { "identifier": "explorationScore", "caption": translate("Exploration score"), "yStart": 16, "width": 100 } | ||||
], | ], | ||||
"titleHeadings": [], | "titleHeadings": [], | ||||
"counters": [ | "counters": [ | ||||
{ "width": 100, "fn": calculateScoreTotal, "verticalOffset": 12 }, | { "width": 100, "fn": calculateScoreTotal, "verticalOffset": 12 }, | ||||
{ "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 } | ||||
], | ], | ||||
"teamCounterFn": calculateScoreTeam | "teamCounterFn": calculateScoreTeam | ||||
}, | }, | ||||
"buildings": { | { | ||||
"caption": translate("Structures"), | "label": translate("Structures"), | ||||
"headings": [ | "headings": [ | ||||
{ "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 105 }, | { "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 105 }, | ||||
{ "identifier": "House", "caption": translate("Houses"), "yStart": 34, "width": 85 }, | { "identifier": "House", "caption": translate("Houses"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Economic", "caption": translate("Economic"), "yStart": 34, "width": 85 }, | { "identifier": "Economic", "caption": translate("Economic"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Outpost", "caption": translate("Outposts"), "yStart": 34, "width": 85 }, | { "identifier": "Outpost", "caption": translate("Outposts"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Military", "caption": translate("Military"), "yStart": 34, "width": 85 }, | { "identifier": "Military", "caption": translate("Military"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Fortress", "caption": translate("Fortresses"), "yStart": 34, "width": 85 }, | { "identifier": "Fortress", "caption": translate("Fortresses"), "yStart": 34, "width": 85 }, | ||||
Show All 20 Lines | "counters": [ | ||||
{ "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": { | { | ||||
"caption": translate("Units"), | "label": translate("Units"), | ||||
"headings": [ | "headings": [ | ||||
{ "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 105 }, | { "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 105 }, | ||||
{ "identifier": "Infantry", "caption": translate("Infantry"), "yStart": 34, "width": 85 }, | { "identifier": "Infantry", "caption": translate("Infantry"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Worker", "caption": translate("Worker"), "yStart": 34, "width": 85 }, | { "identifier": "Worker", "caption": translate("Worker"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Cavalry", "caption": translate("Cavalry"), "yStart": 34, "width": 85 }, | { "identifier": "Cavalry", "caption": translate("Cavalry"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Champion", "caption": translate("Champion"), "yStart": 34, "width": 85 }, | { "identifier": "Champion", "caption": translate("Champion"), "yStart": 34, "width": 85 }, | ||||
{ "identifier": "Hero", "caption": translate("Heroes"), "yStart": 34, "width": 85 }, | { "identifier": "Hero", "caption": translate("Heroes"), "yStart": 34, "width": 85 }, | ||||
Show All 22 Lines | "counters": [ | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnitsWithCaptured, "verticalOffset": 3 }, | { "width": 85, "fn": calculateUnitsWithCaptured, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 }, | ||||
{ "width": 85, "fn": calculateUnits, "verticalOffset": 3 } | { "width": 85, "fn": calculateUnits, "verticalOffset": 3 } | ||||
], | ], | ||||
"teamCounterFn": calculateUnitsTeam | "teamCounterFn": calculateUnitsTeam | ||||
}, | }, | ||||
"resources": { | { | ||||
"caption": translate("Resources"), | "label": translate("Resources"), | ||||
"headings": [ | "headings": [ | ||||
{ "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 110 }, | { "identifier": "total", "caption": translate("Total"), "yStart": 34, "width": 110 }, | ||||
...g_ResourceData.GetResources().map(res => ({ | ...g_ResourceData.GetResources().map(res => ({ | ||||
"identifier": res.code, | "identifier": res.code, | ||||
"caption": resourceNameFirstWord(res.code), | "caption": resourceNameFirstWord(res.code), | ||||
"yStart": 34, | "yStart": 34, | ||||
"width": 100 | "width": 100 | ||||
Show All 33 Lines | "counters": [ | ||||
})), | })), | ||||
{ "width": 121, "fn": calculateTributeSent, "verticalOffset": 12 }, | { "width": 121, "fn": calculateTributeSent, "verticalOffset": 12 }, | ||||
{ "width": 85, "fn": calculateTreasureCollected, "verticalOffset": 12 }, | { "width": 85, "fn": calculateTreasureCollected, "verticalOffset": 12 }, | ||||
{ "width": 85, "fn": calculateLootCollected, "verticalOffset": 12 }, | { "width": 85, "fn": calculateLootCollected, "verticalOffset": 12 }, | ||||
{ "width": 85, "fn": calculateLivestockTrained, "verticalOffset": 12 } | { "width": 85, "fn": calculateLivestockTrained, "verticalOffset": 12 } | ||||
], | ], | ||||
"teamCounterFn": calculateResourcesTeam | "teamCounterFn": calculateResourcesTeam | ||||
}, | }, | ||||
"market": { | { | ||||
"caption": translate("Market"), | "label": translate("Market"), | ||||
"headings": [ | "headings": [ | ||||
{ "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "identifier": "tradeIncome", "caption": translate("Trade income"), "yStart": 16, "width": 100 }, | { "identifier": "tradeIncome", "caption": translate("Trade income"), "yStart": 16, "width": 100 }, | ||||
{ "identifier": "barterEfficency", "caption": translate("Barter efficiency"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | { "identifier": "barterEfficency", "caption": translate("Barter efficiency"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | ||||
...g_ResourceData.GetResources().map(res => { | ...g_ResourceData.GetResources().map(res => { | ||||
return { | return { | ||||
"identifier": res.code, | "identifier": res.code, | ||||
"caption": | "caption": | ||||
Show All 14 Lines | "counters": [ | ||||
...g_ResourceData.GetCodes().map(code => ({ | ...g_ResourceData.GetCodes().map(code => ({ | ||||
"width": 100, | "width": 100, | ||||
"fn": calculateResourceExchanged, | "fn": calculateResourceExchanged, | ||||
"verticalOffset": 12 | "verticalOffset": 12 | ||||
})) | })) | ||||
], | ], | ||||
"teamCounterFn": calculateMarketTeam | "teamCounterFn": calculateMarketTeam | ||||
}, | }, | ||||
"misc": { | { | ||||
"caption": translate("Miscellaneous"), | "label": translate("Miscellaneous"), | ||||
"headings": [ | "headings": [ | ||||
{ "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | { "identifier": "playername", "caption": translate("Player name"), "yStart": 26, "width": 200 }, | ||||
{ "identifier": "killDeath", "caption": translate("Kill / Death ratio"), "yStart": 16, "width": 100, "format": "DECIMAL2" }, | { "identifier": "killDeath", "caption": translate("Kill / Death ratio"), "yStart": 16, "width": 100, "format": "DECIMAL2" }, | ||||
{ "identifier": "mapControlPeak", "caption": translate("Map control (peak)"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | { "identifier": "mapControlPeak", "caption": translate("Map control (peak)"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | ||||
{ "identifier": "mapControl", "caption": translate("Map control (finish)"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | { "identifier": "mapControl", "caption": translate("Map control (finish)"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | ||||
{ "identifier": "mapExploration", "caption": translate("Map exploration"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | { "identifier": "mapExploration", "caption": translate("Map exploration"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | ||||
{ "identifier": "vegetarianRatio", "caption": translate("Vegetarian ratio"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | { "identifier": "vegetarianRatio", "caption": translate("Vegetarian ratio"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | ||||
{ "identifier": "feminization", "caption": translate("Feminization"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | { "identifier": "feminization", "caption": translate("Feminization"), "yStart": 16, "width": 100, "format": "PERCENTAGE" }, | ||||
Show All 16 Lines | "counters": [ | ||||
{ "width": 100, "fn": calculateMapFinalControl, "verticalOffset": 12 }, | { "width": 100, "fn": calculateMapFinalControl, "verticalOffset": 12 }, | ||||
{ "width": 100, "fn": calculateMapExploration, "verticalOffset": 12 }, | { "width": 100, "fn": calculateMapExploration, "verticalOffset": 12 }, | ||||
{ "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": 139, "fn": calculateBribes, "verticalOffset": 12 } | { "width": 139, "fn": calculateBribes, "verticalOffset": 12 } | ||||
], | ], | ||||
"teamCounterFn": calculateMiscellaneousTeam | "teamCounterFn": calculateMiscellaneousTeam | ||||
} | } | ||||
}); | ]; | ||||
var g_ChartPanelsData = [ | |||||
{ | |||||
"label": translate("Charts") | |||||
} | |||||
]; | |||||
function getColoredTypeTranslation(type) | function getColoredTypeTranslation(type) | ||||
{ | { | ||||
return g_SummaryTypes[type].color ? | return g_SummaryTypes[type].color ? | ||||
coloredText(g_SummaryTypes[type].caption, g_SummaryTypes[type].color) : | coloredText(g_SummaryTypes[type].caption, g_SummaryTypes[type].color) : | ||||
g_SummaryTypes[type].caption; | g_SummaryTypes[type].caption; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator