Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/gamesetup.js
Show First 20 Lines • Show All 611 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
/** | /** | ||||
* These dropdowns provide a setting that is repeated once for each player | * These dropdowns provide a setting that is repeated once for each player | ||||
* (where idx is the playerID starting from 0 for player 1). | * (where idx is the playerID starting from 0 for player 1). | ||||
*/ | */ | ||||
var g_PlayerDropdowns = { | var g_PlayerDropdowns = { | ||||
"playerAssignment": { | "playerAssignment": { | ||||
"tooltip": (idx) => translate("Select player."), | |||||
"labels": (idx) => g_PlayerAssignmentList.Name || [], | "labels": (idx) => g_PlayerAssignmentList.Name || [], | ||||
"colors": (idx) => g_PlayerAssignmentList.Color || [], | "colors": (idx) => g_PlayerAssignmentList.Color || [], | ||||
"ids": (idx) => g_PlayerAssignmentList.Choice || [], | "ids": (idx) => g_PlayerAssignmentList.Choice || [], | ||||
"default": (idx) => "ai:petra", | "default": (idx) => "ai:petra", | ||||
"defined": (idx) => idx < g_GameAttributes.settings.PlayerData.length, | "defined": (idx) => idx < g_GameAttributes.settings.PlayerData.length, | ||||
"get": (idx) => { | "get": (idx) => { | ||||
for (let guid in g_PlayerAssignments) | for (let guid in g_PlayerAssignments) | ||||
if (g_PlayerAssignments[guid].player == idx + 1) | if (g_PlayerAssignments[guid].player == idx + 1) | ||||
Show All 18 Lines | "select": (selectedIdx, idx) => { | ||||
g_GameAttributes.settings.PlayerData[idx].AI = choice.startsWith("ai:") ? choice.substr(3) : ""; | g_GameAttributes.settings.PlayerData[idx].AI = choice.startsWith("ai:") ? choice.substr(3) : ""; | ||||
} | } | ||||
else | else | ||||
swapPlayers(choice.substr("guid:".length), idx); | swapPlayers(choice.substr("guid:".length), idx); | ||||
}, | }, | ||||
"autocomplete": true, | "autocomplete": true, | ||||
}, | }, | ||||
"playerTeam": { | "playerTeam": { | ||||
"tooltip": (idx) => translate("Select player's team."), | |||||
"labels": (idx) => g_PlayerTeamList.label, | "labels": (idx) => g_PlayerTeamList.label, | ||||
"ids": (idx) => g_PlayerTeamList.id, | "ids": (idx) => g_PlayerTeamList.id, | ||||
"default": (idx) => 0, | "default": (idx) => 0, | ||||
"defined": (idx) => g_GameAttributes.settings.PlayerData[idx].Team !== undefined, | "defined": (idx) => g_GameAttributes.settings.PlayerData[idx].Team !== undefined, | ||||
"get": (idx) => g_GameAttributes.settings.PlayerData[idx].Team, | "get": (idx) => g_GameAttributes.settings.PlayerData[idx].Team, | ||||
"select": (selectedIdx, idx) => { | "select": (selectedIdx, idx) => { | ||||
g_GameAttributes.settings.PlayerData[idx].Team = selectedIdx - 1; | g_GameAttributes.settings.PlayerData[idx].Team = selectedIdx - 1; | ||||
}, | }, | ||||
"enabled": () => g_GameAttributes.mapType != "scenario", | "enabled": () => g_GameAttributes.mapType != "scenario", | ||||
}, | }, | ||||
"playerCiv": { | "playerCiv": { | ||||
"tooltip": (hoverIdx, idx) => g_PlayerCivList.tooltip[hoverIdx] || translate("Chose the civilization for this player"), | "tooltip": (hoverIdx, idx) => g_PlayerCivList.tooltip[hoverIdx] || translate("Chose the civilization for this player."), | ||||
Imarok: Sure, it's not choose? | |||||
elexisUnsubmitted Not Done Inline Actions2x O is correct elexis: 2x O is correct | |||||
"labels": (idx) => g_PlayerCivList.name, | "labels": (idx) => g_PlayerCivList.name, | ||||
"colors": (idx) => g_PlayerCivList.color, | "colors": (idx) => g_PlayerCivList.color, | ||||
"ids": (idx) => g_PlayerCivList.code, | "ids": (idx) => g_PlayerCivList.code, | ||||
"default": (idx) => 0, | "default": (idx) => 0, | ||||
"defined": (idx) => g_GameAttributes.settings.PlayerData[idx].Civ !== undefined, | "defined": (idx) => g_GameAttributes.settings.PlayerData[idx].Civ !== undefined, | ||||
"get": (idx) => g_GameAttributes.settings.PlayerData[idx].Civ, | "get": (idx) => g_GameAttributes.settings.PlayerData[idx].Civ, | ||||
"select": (selectedIdx, idx) => { | "select": (selectedIdx, idx) => { | ||||
g_GameAttributes.settings.PlayerData[idx].Civ = g_PlayerCivList.code[selectedIdx]; | g_GameAttributes.settings.PlayerData[idx].Civ = g_PlayerCivList.code[selectedIdx]; | ||||
}, | }, | ||||
"enabled": () => g_GameAttributes.mapType != "scenario", | "enabled": () => g_GameAttributes.mapType != "scenario", | ||||
"autocomplete": true, | "autocomplete": true, | ||||
}, | }, | ||||
"playerColorPicker": { | "playerColorPicker": { | ||||
"tooltip": (idx) => translate("Pick a color."), | |||||
"labels": (idx) => g_PlayerColorPickerList.map(color => "■"), | "labels": (idx) => g_PlayerColorPickerList.map(color => "■"), | ||||
"colors": (idx) => g_PlayerColorPickerList.map(color => rgbToGuiColor(color)), | "colors": (idx) => g_PlayerColorPickerList.map(color => rgbToGuiColor(color)), | ||||
"ids": (idx) => g_PlayerColorPickerList.map((color, index) => index), | "ids": (idx) => g_PlayerColorPickerList.map((color, index) => index), | ||||
"default": (idx) => idx, | "default": (idx) => idx, | ||||
"defined": (idx) => g_GameAttributes.settings.PlayerData[idx].Color !== undefined, | "defined": (idx) => g_GameAttributes.settings.PlayerData[idx].Color !== undefined, | ||||
"get": (idx) => g_GameAttributes.settings.PlayerData[idx].Color, | "get": (idx) => g_GameAttributes.settings.PlayerData[idx].Color, | ||||
"select": (selectedIdx, idx) => { | "select": (selectedIdx, idx) => { | ||||
let playerData = g_GameAttributes.settings.PlayerData; | let playerData = g_GameAttributes.settings.PlayerData; | ||||
▲ Show 20 Lines • Show All 397 Lines • ▼ Show 20 Lines | dropdown.onSelectionChange = function() { | ||||
data.select(this.selected, idx); | data.select(this.selected, idx); | ||||
supplementDefaults(); | supplementDefaults(); | ||||
updateGameAttributes(); | updateGameAttributes(); | ||||
}; | }; | ||||
if (data.tooltip) | if (data.tooltip) | ||||
dropdown.onHoverChange = function() { | dropdown.onHoverChange = function() { | ||||
this.tooltip = data.tooltip(this.hovered, idx); | this.tooltip = data.tooltip(this.hovered, idx); | ||||
Not Done Inline Actionsthis is the line to blame for the vanished tooltips: by design we ignore any tooltip set in the xml. One could consider changing fixing this by still looking at them, but then what if both (xml and g_PlayerDropdowns) are present? bb: this is the line to blame for the vanished tooltips: by design we ignore any tooltip set in the… | |||||
}; | }; | ||||
} | } | ||||
function initPlayerDropdowns(name) | function initPlayerDropdowns(name) | ||||
{ | { | ||||
for (let i = 0; i < g_MaxPlayers; ++i) | for (let i = 0; i < g_MaxPlayers; ++i) | ||||
initDropdown(name, i); | initDropdown(name, i); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,192 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Sure, it's not choose?