Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/gamedescription.js
/** | /** | ||||
* Highlights the victory condition in the game-description. | * Highlights the victory condition in the game-description. | ||||
*/ | */ | ||||
var g_DescriptionHighlight = "orange"; | var g_DescriptionHighlightTextTags = { "color": "orange" }; | ||||
/** | |||||
* Font of the teams. | |||||
*/ | |||||
var g_TeamDescriptionCaptionTextTags = { "font": "sans-bold-14" }; | |||||
elexis: This has the suffix Tag, but the one above doesn't have it. It would be good to move towards… | |||||
/** | /** | ||||
* The rating assigned to lobby players who didn't complete a ranked 1v1 yet. | * The rating assigned to lobby players who didn't complete a ranked 1v1 yet. | ||||
*/ | */ | ||||
var g_DefaultLobbyRating = 1200; | var g_DefaultLobbyRating = 1200; | ||||
/** | /** | ||||
* XEP-0172 doesn't restrict nicknames, but our lobby policy does. | * XEP-0172 doesn't restrict nicknames, but our lobby policy does. | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | for (let playerData of playerDataArray) | ||||
let playerNick = splitRatingFromNick(playerData.Name).nick; | let playerNick = splitRatingFromNick(playerData.Name).nick; | ||||
playerDescriptions[teamIdx].push(sprintf(playerDescription, { | playerDescriptions[teamIdx].push(sprintf(playerDescription, { | ||||
"playerName": | "playerName": | ||||
coloredText( | coloredText( | ||||
(g_Buddies.indexOf(playerNick) != -1 ? g_BuddySymbol + " " : "") + | (g_Buddies.indexOf(playerNick) != -1 ? g_BuddySymbol + " " : "") + | ||||
escapeText(playerData.Name), | escapeText(playerData.Name), | ||||
(typeof getPlayerColor == 'function' ? | (typeof getPlayerColor == 'function' ? | ||||
(isAI ? "white" : getPlayerColor(playerNick)) : | (isAI ? "white" : getPlayerColor(playerNick)) : | ||||
rgbToGuiColor(playerData.Color || g_Settings.PlayerDefaults[playerIdx].Color))), | rgbToGuiColor(playerData.Color || g_Settings.PlayerDefaults[playerIdx].Color))), | ||||
Done Inline ActionsWhats the added obejct adding for a benefit? elexis: Whats the added obejct adding for a benefit? | |||||
Done Inline Actions(Not a fan of ) on a separate line, since it is not a data structure, not a scope) elexis: (Not a fan of `)` on a separate line, since it is not a data structure, not a scope) | |||||
"civ": | "civ": | ||||
!playerData.Civ ? | !playerData.Civ ? | ||||
translate("Unknown Civilization") : | translate("Unknown Civilization") : | ||||
g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? | g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? | ||||
translate(g_CivData[playerData.Civ].Name) : | translate(g_CivData[playerData.Civ].Name) : | ||||
playerData.Civ, | playerData.Civ, | ||||
"state": | "state": | ||||
Show All 20 Lines | else | ||||
teamDescription = teams.map(team => { | teamDescription = teams.map(team => { | ||||
let teamCaption = team == -1 ? | let teamCaption = team == -1 ? | ||||
translate("No Team") : | translate("No Team") : | ||||
sprintf(translate("Team %(team)s"), { "team": +team + 1 }); | sprintf(translate("Team %(team)s"), { "team": +team + 1 }); | ||||
// Translation: Describe players of one team in a selected game, f.e. in the replay- or savegame menu or lobby | // Translation: Describe players of one team in a selected game, f.e. in the replay- or savegame menu or lobby | ||||
return sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { | return sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { | ||||
"team": '[font="sans-bold-14"]' + teamCaption + "[/font]", | "team": setStringTags(teamCaption, g_TeamDescriptionCaptionTextTags), | ||||
"playerDescriptions": playerDescriptions[team].join("\n") | "playerDescriptions": playerDescriptions[team].join("\n") | ||||
}); | }); | ||||
}); | }); | ||||
if (playerDescriptions.observer) | if (playerDescriptions.observer) | ||||
teamDescription.push(sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { | teamDescription.push(sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { | ||||
"team": '[font="sans-bold-14"]' + translatePlural("Observer", "Observers", playerDescriptions.observer.length) + "[/font]", | "team": setStringTags(translatePlural("Observer", "Observers", playerDescriptions.observer.length), g_TeamDescriptionCaptionTextTags), | ||||
"playerDescriptions": playerDescriptions.observer.join("\n") | "playerDescriptions": playerDescriptions.observer.join("\n") | ||||
})); | })); | ||||
return teamDescription.join("\n\n"); | return teamDescription.join("\n\n"); | ||||
} | } | ||||
/** | /** | ||||
* Sets an additional map label, map preview image and describes the chosen gamesettings more closely. | * Sets an additional map label, map preview image and describes the chosen gamesettings more closely. | ||||
▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | function getGameDescription() | ||||
}); | }); | ||||
titles.push({ | titles.push({ | ||||
"label": translate("Cheats"), | "label": translate("Cheats"), | ||||
"value": g_GameAttributes.settings.CheatsEnabled | "value": g_GameAttributes.settings.CheatsEnabled | ||||
}); | }); | ||||
return titles.map(title => sprintf(translate("%(label)s %(details)s"), { | return titles.map(title => sprintf(translate("%(label)s %(details)s"), { | ||||
"label": coloredText(title.label, g_DescriptionHighlight), | "label": setStringTags(title.label, g_DescriptionHighlightTextTags), | ||||
"details": | "details": | ||||
title.value === true ? translateWithContext("gamesetup option", "enabled") : | title.value === true ? translateWithContext("gamesetup option", "enabled") : | ||||
title.value || translateWithContext("gamesetup option", "disabled") | title.value || translateWithContext("gamesetup option", "disabled") | ||||
})).join("\n"); | })).join("\n"); | ||||
} | } | ||||
/** | /** | ||||
* Sets the win/defeat icon to indicate current player's state. | * Sets the win/defeat icon to indicate current player's state. | ||||
Show All 30 Lines |
Wildfire Games · Phabricator
This has the suffix Tag, but the one above doesn't have it. It would be good to move towards global consistency.