Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/common/gamedescription.js
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | for (let playerData of playerDataArray) | ||||
let playerDescription; | let playerDescription; | ||||
if (isAI) | if (isAI) | ||||
{ | { | ||||
if (playerData.Civ) | if (playerData.Civ) | ||||
{ | { | ||||
if (isActive) | if (isActive) | ||||
// Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | ||||
playerDescription = translate("%(playerName)s (%(civ)s, %(AIdifficulty)s %(AIbehavior)s %(AIname)s)"); | playerDescription = translate("%(playerName)s (%(civ)s, %(AIdescription)s)"); | ||||
else | else | ||||
// Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | ||||
playerDescription = translate("%(playerName)s (%(civ)s, %(AIdifficulty)s %(AIbehavior)s %(AIname)s, %(state)s)"); | playerDescription = translate("%(playerName)s (%(civ)s, %(AIdescription)s, %(state)s)"); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (isActive) | if (isActive) | ||||
// Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | ||||
playerDescription = translate("%(playerName)s (%(AIdifficulty)s %(AIbehavior)s %(AIname)s)"); | playerDescription = translate("%(playerName)s (%(AIdescription)s)"); | ||||
else | else | ||||
// Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu | ||||
playerDescription = translate("%(playerName)s (%(AIdifficulty)s %(AIbehavior)s %(AIname)s, %(state)s)"); | playerDescription = translate("%(playerName)s (%(AIdescription)s, %(state)s)"); | ||||
} | } | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (playerData.Offline) | if (playerData.Offline) | ||||
{ | { | ||||
// Can only occur in the lobby for now, so no strings with civ needed | // Can only occur in the lobby for now, so no strings with civ needed | ||||
if (isActive) | if (isActive) | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | playerDescriptions[teamIdx].push(sprintf(playerDescription, { | ||||
translate(g_CivData[playerData.Civ].Name) : | translate(g_CivData[playerData.Civ].Name) : | ||||
playerData.Civ, | playerData.Civ, | ||||
"state": | "state": | ||||
playerState == "defeated" ? | playerState == "defeated" ? | ||||
translateWithContext("playerstate", "defeated") : | translateWithContext("playerstate", "defeated") : | ||||
translateWithContext("playerstate", "won"), | translateWithContext("playerstate", "won"), | ||||
"AIname": isAI ? translateAIName(playerData.AI) : "", | "AIdescription": translateAISettings(playerData) | ||||
"AIdifficulty": isAI ? translateAIDifficulty(playerData.AIDiff) : "", | |||||
"AIbehavior": isAI ? translateAIBehavior(playerData.AIBehavior) : "" | |||||
})); | })); | ||||
} | } | ||||
let teams = Object.keys(playerDescriptions); | let teams = Object.keys(playerDescriptions); | ||||
if (teams.indexOf("observer") > -1) | if (teams.indexOf("observer") > -1) | ||||
teams.splice(teams.indexOf("observer"), 1); | teams.splice(teams.indexOf("observer"), 1); | ||||
let teamDescription = []; | let teamDescription = []; | ||||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Lines | if (state == "won") | ||||
image.tooltip = translate("Victorious"); | image.tooltip = translate("Victorious"); | ||||
} | } | ||||
else if (state == "defeated") | else if (state == "defeated") | ||||
{ | { | ||||
image.sprite = "stretched:session/icons/defeat.png"; | image.sprite = "stretched:session/icons/defeat.png"; | ||||
image.tooltip = translate("Defeated"); | image.tooltip = translate("Defeated"); | ||||
} | } | ||||
} | } | ||||
function translateAISettings(playerData) | |||||
{ | |||||
if (!playerData.AI) | |||||
return ""; | |||||
return sprintf(translate("%(AIdifficulty)s %(AIbehavior)s %(AIname)s"), { | |||||
"AIname": translateAIName(playerData.AI), | |||||
"AIdifficulty": translateAIDifficulty(playerData.AIDiff), | |||||
"AIbehavior": translateAIBehavior(playerData.AIBehavior), | |||||
}); | |||||
} |
Wildfire Games · Phabricator