Ticket #4141: better_gamesetup_descriptions_v1.patch
File better_gamesetup_descriptions_v1.patch, 9.9 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/data/settings/victory_conditions/conquest.json
1 1 { 2 2 "TranslatedKeys": ["Title", "Description"], 3 3 "Data": 4 4 { 5 5 "Title": "Conquest", 6 "Description": "Defeat all opponents ",6 "Description": "Defeat all opponents to win.", 7 7 "Scripts": 8 8 [ 9 9 "scripts/TriggerHelper.js", 10 10 "scripts/ConquestCommon.js", 11 11 "scripts/Conquest.js" -
binaries/data/mods/public/simulation/data/settings/victory_conditions/conquest_structures.json
1 1 { 2 2 "TranslatedKeys": ["Title", "Description"], 3 3 "Data": 4 4 { 5 5 "Title": "Conquest Structures", 6 "Description": "Destroy all structures of enemies",6 "Description": "Destroy all enemy structures to win.", 7 7 "Scripts": 8 8 [ 9 9 "scripts/TriggerHelper.js", 10 10 "scripts/ConquestCommon.js", 11 11 "scripts/ConquestStructures.js" -
binaries/data/mods/public/simulation/data/settings/victory_conditions/conquest_units.json
1 1 { 2 2 "TranslatedKeys": ["Title", "Description"], 3 3 "Data": 4 4 { 5 5 "Title": "Conquest Units", 6 "Description": "Kill all enemy units ",6 "Description": "Kill all enemy units to win.", 7 7 "Scripts": 8 8 [ 9 9 "scripts/TriggerHelper.js", 10 10 "scripts/ConquestCommon.js", 11 11 "scripts/ConquestUnits.js" -
binaries/data/mods/public/simulation/data/settings/victory_conditions/regicide.json
1 1 { 2 2 "TranslatedKeys": ["Title", "Description"], 3 3 "Data": 4 4 { 5 5 "Title": "Regicide", 6 "Description": "Defeat opponents by killing their hero ",6 "Description": "Defeat opponents by killing their hero.", 7 7 "Scripts": 8 8 [ 9 9 "scripts/TriggerHelper.js", 10 10 "scripts/ConquestCommon.js", 11 11 "scripts/Conquest.js", -
binaries/data/mods/public/simulation/data/settings/victory_conditions/wonder.json
1 1 { 2 2 "TranslatedKeys": ["Title", "Description"], 3 3 "Data": 4 4 { 5 5 "Title": "Wonder", 6 "Description": "B uild and protect a wonder to win",6 "Description": "Be the first to build or capture a wonder and keep it for a certain time to win the game.", 7 7 "Scripts": 8 8 [ 9 9 "scripts/TriggerHelper.js", 10 10 "scripts/ConquestCommon.js", 11 11 "scripts/Conquest.js", -
binaries/data/mods/public/gui/common/settings.js
function loadVictoryConditions() 224 224 // TODO: We might support enabling victory conditions separately sometime. 225 225 // Until then, we supplement the endless gametype here. 226 226 victoryConditions.push({ 227 227 "Name": "endless", 228 228 "Title": translate("None"), 229 "Description": translate("Endless Game"),229 "Description": translate("Endless game."), 230 230 "Scripts": [] 231 231 }); 232 232 233 233 return victoryConditions; 234 234 } -
binaries/data/mods/public/gui/gamesetup/gamesetup.js
const g_UnassignedPlayerColor = "170 170 134 134 const g_ReadyColor = "green"; 135 135 136 136 /** 137 137 * Highlights the victory condition in the game-description. 138 138 */ 139 const g_ VictoryColor= "orange";139 const g_DescriptionHighlight = "orange"; 140 140 141 141 /** 142 142 * Placeholder item for the map-dropdownlist. 143 143 */ 144 144 const g_RandomMap = '[color="' + g_ColorRandom + '"]' + translateWithContext("map selection", "Random") + "[/color]"; … … function updateGUIObjects() 1454 1454 pColorPickerHeading.hidden = !canChangeColors; 1455 1455 if (canChangeColors) 1456 1456 pColorPicker.selected = g_PlayerColors.findIndex(col => sameColor(col, color)); 1457 1457 } 1458 1458 1459 update MapDescription();1459 updateGameDescription(); 1460 1460 resizeMoreOptionsWindow(); 1461 1461 1462 1462 g_IsInGuiUpdate = false; 1463 1463 1464 1464 // Game attributes include AI settings, so update the player list … … function updateGUIObjects() 1473 1473 openAIConfig(g_LastViewedAIPlayer); 1474 1474 } 1475 1475 } 1476 1476 1477 1477 /** 1478 * Sets an additional map label, map preview image and mapsettings description.1478 * Sets an additional map label, map preview image and describes the chosen gamesettings more closely. 1479 1479 */ 1480 function update MapDescription()1480 function updateGameDescription() 1481 1481 { 1482 1482 setMapPreviewImage("mapPreview", getMapPreview(g_GameAttributes.map)); 1483 1483 1484 1484 Engine.GetGUIObjectByName("mapInfoName").caption = 1485 1485 translateMapTitle(getMapDisplayName(g_GameAttributes.map)); 1486 1486 1487 let numPlayers = sprintf( 1488 translatePlural( 1489 "%(number)s player. ", 1490 "%(number)s players. ", 1491 g_GameAttributes.settings.PlayerData.length 1492 ), 1493 { "number": g_GameAttributes.settings.PlayerData.length } 1494 ); 1495 1496 let mapDescription = 1497 g_GameAttributes.map == "random" ? 1498 translate("Randomly selects a map from the list") : 1499 g_GameAttributes.settings.Description ? 1500 translate(g_GameAttributes.settings.Description) : 1501 translate("Sorry, no description available."); 1502 1487 let victoryTitle = ""; 1503 1488 let victoryIdx = g_VictoryConditions.Name.indexOf(g_GameAttributes.settings.GameType || g_VictoryConditions.Default); 1504 let victoryTitle; 1505 1506 if (victoryIdx == -1) 1507 victoryTitle = translateWithContext("victory condition", "Unknown"); 1508 else 1489 if (victoryIdx != -1) 1509 1490 { 1491 let title = g_VictoryConditions.Title[victoryIdx]; 1510 1492 if (g_VictoryConditions.Name[victoryIdx] == "wonder") 1511 victoryTitle = sprintf(1493 title = sprintf( 1512 1494 translatePluralWithContext( 1513 1495 "victory condition", 1514 1496 "Wonder (%(min)s minute)", 1515 1497 "Wonder (%(min)s minutes)", 1516 1498 g_GameAttributes.settings.WonderDuration 1517 1499 ), 1518 1500 { "min": g_GameAttributes.settings.WonderDuration } 1519 1501 ); 1520 else1521 victoryTitle = g_VictoryConditions.Title[victoryIdx];1522 1502 1523 if (victoryIdx != g_VictoryConditions.Default) 1524 victoryTitle = "[color=\"" + g_VictoryColor + "\"]" + victoryTitle + "[/color]"; 1525 } 1503 victoryTitle = sprintf(translate("%(VictoryCondition)s: %(Description)s"), { 1504 "VictoryCondition": "[color=\"" + g_DescriptionHighlight + "\"]" + title + "[/color]", 1505 "Description": g_VictoryConditions.Description[victoryIdx] 1506 }) + "\n"; 1507 } 1508 1509 let is1v1 = g_GameAttributes.settings.PlayerData.length == 2; 1510 let isRated = g_GameAttributes.settings.RatingEnabled && is1v1; 1511 let ratedGameTitle = !isRated ? "" : 1512 sprintf(translate("%(RatedGame)s: %(Description)s"), { 1513 "RatedGame": 1514 "[color=\"" + g_DescriptionHighlight + "\"]" + 1515 translate("Rated game") + 1516 "[/color]", 1517 "Description": translate("When the winner of this match was determined, the lobby score will adapt.") 1518 }) + "\n"; 1519 1520 let lockedTeamsTitle = isRated ? "" : 1521 sprintf(translate("%(LockedTeams)s: %(Description)s"), { 1522 "LockedTeams": 1523 "[color=\"" + g_DescriptionHighlight + "\"]" + 1524 (g_GameAttributes.settings.LockTeams ? 1525 translate("Locked Teams") : 1526 translate("Diplomacy")) + 1527 "[/color]", 1528 "Description": 1529 g_GameAttributes.settings.LockTeams ? 1530 translate("Players can't change the initial teams.") : 1531 translate("Players can setup alliances and declare war on allies.") 1532 }) + "\n"; 1533 1534 let lastManStandingTitle = is1v1 ? "" : 1535 sprintf(translate("%(LastManStanding)s: %(Description)s"), { 1536 "LastManStanding": 1537 "[color=\"" + g_DescriptionHighlight + "\"]" + 1538 (g_GameAttributes.settings.LastManStanding ? 1539 translate("Last Man Standing") : 1540 translate("Allied Victory")) + 1541 "[/color]", 1542 "Description": 1543 g_GameAttributes.settings.LastManStanding ? 1544 translateWithContext("lastManStanding", "Only one player can win the game.") + " " + 1545 translateWithContext("lastManStanding", "If the remaining players are allies, the game continues until only one remains.") : 1546 translateWithContext("allied victory", "If one player wins, his allies win too.") + " " + 1547 translateWithContext("allied victory", "If one group of allies remains, they win.") 1548 }) + "\n"; 1549 1550 let mapDescription = sprintf(translate("%(Map)s: %(Description)s"), { 1551 "Map": 1552 "[color=\"" + g_DescriptionHighlight + "\"]" + 1553 translate("Map") + 1554 "[/color]", 1555 "Description": 1556 g_GameAttributes.map == "random" ? 1557 translate("Randomly selects a map from the list") : 1558 g_GameAttributes.settings.Description ? 1559 translate(g_GameAttributes.settings.Description) : 1560 translate("Sorry, no description available."), 1561 }); 1526 1562 1527 1563 Engine.GetGUIObjectByName("mapInfoDescription").caption = 1528 numPlayers + 1529 translate("Victory Condition:") + " " + victoryTitle + ".\n\n" + 1564 victoryTitle + 1565 ratedGameTitle + 1566 lockedTeamsTitle + 1567 lastManStandingTitle + 1530 1568 mapDescription; 1531 1569 } 1532 1570 1533 1571 /** 1534 1572 * Broadcast the changed settings to all clients and the lobbybot.