Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/ai.txt =================================================================== --- ps/trunk/binaries/data/mods/public/gui/gamesetup/ai.txt (revision 23373) +++ ps/trunk/binaries/data/mods/public/gui/gamesetup/ai.txt (nonexistent) @@ -1 +0,0 @@ -Although reasonably easy for an experienced player, the default AI level is quite challenging for new players yet to master the basic mechanisms of the game. Beginners are advised to start by playing against a lower level AI (Sandbox or Very Easy). Change the AI level by clicking the gear icon next to the player you want to modify in the selection panel above. Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/ai.txt ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js (nonexistent) +++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js (revision 23374) @@ -0,0 +1,62 @@ +GameSettingControls.LockedTeams = class extends GameSettingControlCheckbox +{ + onMapChange(mapData) + { + let mapValue = + mapData && + mapData.settings && + !mapData.settings.LockTeams && + mapData.settings.LastManStanding; + + if (mapValue !== undefined && mapValue != g_GameAttributes.settings.LastManStanding) + { + g_GameAttributes.settings.LastManStanding = mapValue; + this.gameSettingsControl.updateGameAttributes(); + } + } + + onGameAttributesChange() + { + if (!g_GameAttributes.mapType) + return; + + if (g_GameAttributes.settings.LockTeams === undefined || + g_GameAttributes.settings.RatingEnabled && !g_GameAttributes.settings.LockTeams) + { + g_GameAttributes.settings.LockTeams = g_IsNetworked; + this.gameSettingsControl.updateGameAttributes(); + } + } + + onGameAttributesBatchChange() + { + if (!g_GameAttributes.mapType) + return; + + this.setChecked(g_GameAttributes.settings.LockTeams); + + this.setEnabled( + g_GameAttributes.mapType != "scenario" && + !g_GameAttributes.settings.RatingEnabled); + } + + onPress(checked) + { + g_GameAttributes.settings.LockTeams = checked; + this.gameSettingsControl.updateGameAttributes(); + this.gameSettingsControl.setNetworkGameAttributes(); + } +}; + +GameSettingControls.LockedTeams.prototype.TitleCaption = + translate("Teams Locked"); + +GameSettingControls.LockedTeams.prototype.Tooltip = + translate("Toggle locked teams."); + +/** + * In multiplayer mode, players negotiate teams before starting the match and + * expect to play the match with these teams unless explicitly stated otherwise during the match settings. + * For singleplayermode, preserve the historic default of open diplomacies. + */ +GameSettingControls.LockedTeams.prototype.DefaultValue = Engine.HasNetClient(); Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js (nonexistent) +++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js (revision 23374) @@ -0,0 +1,78 @@ +PlayerSettingControls.PlayerTeam = class extends GameSettingControlDropdown +{ + constructor(...args) + { + super(...args); + + this.values = prepareForDropdown([ + { + "label": this.NoTeam, + "id": this.NoTeamId + }, + ...Array.from( + new Array(g_MaxTeams), + (v, i) => ({ + "label": i + 1, + "id": i + })) + ]); + this.dropdown.list = this.values.label; + this.dropdown.list_data = this.values.id; + } + + setControl() + { + this.label = Engine.GetGUIObjectByName("playerTeamText[" + this.playerIndex + "]"); + this.dropdown = Engine.GetGUIObjectByName("playerTeam[" + this.playerIndex + "]"); + } + + onMapChange(mapData) + { + let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex); + let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); + + if (pData && mapPData && mapPData.Team !== undefined) + { + pData.Team = mapPData.Team; + this.gameSettingsControl.updateGameAttributes(); + } + } + + onGameAttributesChange() + { + let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); + if (!pData) + return; + + if (pData.Team === undefined) + { + pData.Team = this.NoTeamId; + this.gameSettingsControl.updateGameAttributes(); + } + } + + onGameAttributesBatchChange() + { + let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); + if (!pData) + return; + + this.setEnabled(g_GameAttributes.mapType != "scenario"); + this.setSelectedValue(pData.Team); + } + + onSelectionChange(itemIdx) + { + g_GameAttributes.settings.PlayerData[this.playerIndex].Team = itemIdx - 1; + this.gameSettingsControl.updateGameAttributes(); + this.gameSettingsControl.setNetworkGameAttributes(); + } +}; + +PlayerSettingControls.PlayerTeam.prototype.Tooltip = + translate("Select player's team."); + +PlayerSettingControls.PlayerTeam.prototype.NoTeam = + translateWithContext("team", "None"); + +PlayerSettingControls.PlayerTeam.prototype.NoTeamId = -1; Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js (nonexistent) +++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js (revision 23374) @@ -0,0 +1,129 @@ +// TODO: There should be an indication which player is not ready yet +// The color does not indicate it's meaning and is insufficient to inform many players. +PlayerSettingControls.PlayerName = class extends GameSettingControl +{ + constructor(...args) + { + super(...args); + + this.playerName = Engine.GetGUIObjectByName("playerName[" + this.playerIndex + "]"); + + this.displayedName = undefined; + this.guid = undefined; + } + + onMapChange(mapData) + { + let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); + if (!pData) + return; + + let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex); + pData.Name = mapPData && mapPData.Name || g_Settings.PlayerDefaults[this.playerIndex + 1].Name; + this.gameSettingsControl.updateGameAttributes(); + } + + onGameAttributesChange() + { + let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); + if (!pData) + return; + + if (!pData.Name) + { + pData.Name = g_Settings.PlayerDefaults[this.playerIndex + 1].Name; + this.gameSettingsControl.updateGameAttributes(); + } + } + + onGameAttributesBatchChange() + { + let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); + if (!pData) + return; + + this.displayedName = g_IsNetworked ? pData.Name : translate(pData.Name); + this.rebuild(); + } + + onPlayerAssignmentsChange() + { + this.guid = undefined; + + for (let guid in g_PlayerAssignments) + if (g_PlayerAssignments[guid].player == this.playerIndex + 1) + { + this.guid = guid; + break; + } + + this.rebuild(); + } + + rebuild() + { + let name = this.displayedName; + if (!name) + return; + + if (g_IsNetworked) + { + let status = this.guid ? g_PlayerAssignments[this.guid].status : this.ReadyTags.length - 1; + name = setStringTags(this.displayedName, this.ReadyTags[status]); + } + + this.playerName.caption = name; + } + + onGameAttributesFinalize() + { + let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex); + if (!pData) + return; + + if (g_GameAttributes.mapType != "scenario" && pData.AI) + { + // Pick one of the available botnames for the chosen civ + // Determine botnames + let chosenName = pickRandom(g_CivData[pData.Civ].AINames); + + if (!g_IsNetworked) + chosenName = translate(chosenName); + + // Count how many players use the chosenName + let usedName = g_GameAttributes.settings.PlayerData.filter(otherPData => + otherPData.Name && otherPData.Name.indexOf(chosenName) !== -1).length; + + pData.Name = + usedName ? + sprintf(this.RomanLabel, { + "playerName": chosenName, + "romanNumber": this.RomanNumbers[usedName + 1] + }) : + chosenName; + } + else + // Copy client playernames so they appear in replays + for (let guid in g_PlayerAssignments) + if (g_PlayerAssignments[guid].player == this.playerIndex + 1) + pData.Name = g_PlayerAssignments[guid].name; + } +}; + +PlayerSettingControls.PlayerName.prototype.RomanLabel = + translate("%(playerName)s %(romanNumber)s"); + +PlayerSettingControls.PlayerName.prototype.RomanNumbers = + [undefined, "I", "II", "III", "IV", "V", "VI", "VII", "VIII"]; + +PlayerSettingControls.PlayerName.prototype.ReadyTags = [ + { + "color": "white", + }, + { + "color": "green", + }, + { + "color": "150 150 250", + } +]; Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayersPanel.xml =================================================================== --- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayersPanel.xml (nonexistent) +++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayersPanel.xml (revision 23374) @@ -0,0 +1,55 @@ + + + + + + Player Name + + + + Color + + + + Player Placement + + + + Civilization + + + + + + + Team + + + + + + + +