Differential D3711 Diff 16562 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js
Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex, guidToAssign) | ||||
if (g_GameSettings.map.type !== "scenario") | if (g_GameSettings.map.type !== "scenario") | ||||
{ | { | ||||
g_GameSettings.playerCiv.swap(sourcePlayer, playerIndex); | g_GameSettings.playerCiv.swap(sourcePlayer, playerIndex); | ||||
g_GameSettings.playerColor.swap(sourcePlayer, playerIndex); | g_GameSettings.playerColor.swap(sourcePlayer, playerIndex); | ||||
} | } | ||||
} | } | ||||
playerAssignmentsControl.assignPlayer(guidToAssign, playerIndex); | playerAssignmentsControl.assignPlayer(guidToAssign, playerIndex); | ||||
gameSettingsControl.setNetworkGameAttributes(); | gameSettingsControl.setNetworkInitAttributes(); | ||||
} | } | ||||
isSelected(pData, guid, value) | isSelected(pData, guid, value) | ||||
{ | { | ||||
return guid !== undefined && guid == value; | return guid !== undefined && guid == value; | ||||
} | } | ||||
}; | }; | ||||
Show All 23 Lines | onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex, value) | ||||
playerAssignmentsControl.unassignClient(playerIndex + 1); | playerAssignmentsControl.unassignClient(playerIndex + 1); | ||||
g_GameSettings.playerAI.set(playerIndex, { | g_GameSettings.playerAI.set(playerIndex, { | ||||
"bot": value, | "bot": value, | ||||
"difficulty": +Engine.ConfigDB_GetValue("user", "gui.gamesetup.aidifficulty"), | "difficulty": +Engine.ConfigDB_GetValue("user", "gui.gamesetup.aidifficulty"), | ||||
"behavior": Engine.ConfigDB_GetValue("user", "gui.gamesetup.aibehavior"), | "behavior": Engine.ConfigDB_GetValue("user", "gui.gamesetup.aibehavior"), | ||||
}); | }); | ||||
gameSettingsControl.setNetworkGameAttributes(); | gameSettingsControl.setNetworkInitAttributes(); | ||||
} | } | ||||
isSelected(pData, guid, value) | isSelected(pData, guid, value) | ||||
{ | { | ||||
return !guid && pData.AI && pData.AI == value; | return !guid && pData.AI && pData.AI == value; | ||||
} | } | ||||
}; | }; | ||||
Show All 18 Lines | PlayerAssignmentItem.Unassigned = class | ||||
} | } | ||||
onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex) | onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex) | ||||
{ | { | ||||
playerAssignmentsControl.unassignClient(playerIndex + 1); | playerAssignmentsControl.unassignClient(playerIndex + 1); | ||||
g_GameSettings.playerAI.setAI(playerIndex, undefined); | g_GameSettings.playerAI.setAI(playerIndex, undefined); | ||||
gameSettingsControl.setNetworkGameAttributes(); | gameSettingsControl.setNetworkInitAttributes(); | ||||
} | } | ||||
isSelected(pData, guid, value) | isSelected(pData, guid, value) | ||||
{ | { | ||||
return !guid && !pData.AI; | return !guid && !pData.AI; | ||||
} | } | ||||
}; | }; | ||||
PlayerAssignmentItem.Unassigned.prototype.Label = | PlayerAssignmentItem.Unassigned.prototype.Label = | ||||
translate("Unassigned"); | translate("Unassigned"); | ||||
PlayerAssignmentItem.Unassigned.prototype.Tags = | PlayerAssignmentItem.Unassigned.prototype.Tags = | ||||
{ "color": "140 140 140" }; | { "color": "140 140 140" }; | ||||
} | } |
Wildfire Games · Phabricator