Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/gamesetup.js
Show First 20 Lines • Show All 512 Lines • ▼ Show 20 Lines | |||||
* Assign update-functions to all checkboxes. | * Assign update-functions to all checkboxes. | ||||
*/ | */ | ||||
function initRadioButtons() | function initRadioButtons() | ||||
{ | { | ||||
let options = { | let options = { | ||||
"RevealMap": "revealMap", | "RevealMap": "revealMap", | ||||
"ExploreMap": "exploreMap", | "ExploreMap": "exploreMap", | ||||
"DisableTreasures": "disableTreasures", | "DisableTreasures": "disableTreasures", | ||||
"EnableSpies": "enableSpies", | |||||
"LockTeams": "lockTeams", | "LockTeams": "lockTeams", | ||||
"LastManStanding" : "lastManStanding", | "LastManStanding" : "lastManStanding", | ||||
"CheatsEnabled": "enableCheats" | "CheatsEnabled": "enableCheats" | ||||
}; | }; | ||||
Object.keys(options).forEach(attribute => { | Object.keys(options).forEach(attribute => { | ||||
Engine.GetGUIObjectByName(options[attribute]).onPress = function() { | Engine.GetGUIObjectByName(options[attribute]).onPress = function() { | ||||
g_GameAttributes.settings[attribute] = this.checked; | g_GameAttributes.settings[attribute] = this.checked; | ||||
▲ Show 20 Lines • Show All 887 Lines • ▼ Show 20 Lines | function updateGUIObjects() | ||||
Engine.GetGUIObjectByName("wonderDurationText").caption = g_WonderDurations.Title[wonderDurationIdx]; | Engine.GetGUIObjectByName("wonderDurationText").caption = g_WonderDurations.Title[wonderDurationIdx]; | ||||
Engine.GetGUIObjectByName("populationCapText").caption = g_PopulationCapacities.Title[popIdx]; | Engine.GetGUIObjectByName("populationCapText").caption = g_PopulationCapacities.Title[popIdx]; | ||||
Engine.GetGUIObjectByName("startingResourcesText").caption = g_StartingResources.Title[startingResIdx]; | Engine.GetGUIObjectByName("startingResourcesText").caption = g_StartingResources.Title[startingResIdx]; | ||||
Engine.GetGUIObjectByName("ceasefireText").caption = g_Ceasefire.Title[ceasefireIdx]; | Engine.GetGUIObjectByName("ceasefireText").caption = g_Ceasefire.Title[ceasefireIdx]; | ||||
Engine.GetGUIObjectByName("gameSpeedText").caption = g_GameSpeeds.Title[gameSpeedIdx]; | Engine.GetGUIObjectByName("gameSpeedText").caption = g_GameSpeeds.Title[gameSpeedIdx]; | ||||
setGUIBoolean("enableCheats", "enableCheatsText", !!mapSettings.CheatsEnabled); | setGUIBoolean("enableCheats", "enableCheatsText", !!mapSettings.CheatsEnabled); | ||||
setGUIBoolean("disableTreasures", "disableTreasuresText", !!mapSettings.DisableTreasures); | setGUIBoolean("disableTreasures", "disableTreasuresText", !!mapSettings.DisableTreasures); | ||||
setGUIBoolean("enableSpies", "enableSpiesText", !!mapSettings.EnableSpies); | |||||
setGUIBoolean("exploreMap", "exploreMapText", !!mapSettings.ExploreMap); | setGUIBoolean("exploreMap", "exploreMapText", !!mapSettings.ExploreMap); | ||||
setGUIBoolean("revealMap", "revealMapText", !!mapSettings.RevealMap); | setGUIBoolean("revealMap", "revealMapText", !!mapSettings.RevealMap); | ||||
setGUIBoolean("lockTeams", "lockTeamsText", !!mapSettings.LockTeams); | setGUIBoolean("lockTeams", "lockTeamsText", !!mapSettings.LockTeams); | ||||
setGUIBoolean("lastManStanding", "lastManStandingText", !!mapSettings.LastManStanding); | setGUIBoolean("lastManStanding", "lastManStandingText", !!mapSettings.LastManStanding); | ||||
setGUIBoolean("enableRating", "enableRatingText", !!mapSettings.RatingEnabled); | setGUIBoolean("enableRating", "enableRatingText", !!mapSettings.RatingEnabled); | ||||
Engine.GetGUIObjectByName("optionWonderDuration").hidden = | Engine.GetGUIObjectByName("optionWonderDuration").hidden = | ||||
g_GameAttributes.settings.GameType && | g_GameAttributes.settings.GameType && | ||||
Show All 11 Lines | function updateGUIObjects() | ||||
Engine.GetGUIObjectByName("mapSize").hidden = !isRandom || !g_IsController; | Engine.GetGUIObjectByName("mapSize").hidden = !isRandom || !g_IsController; | ||||
Engine.GetGUIObjectByName("mapSizeText").hidden = !isRandom || g_IsController; | Engine.GetGUIObjectByName("mapSizeText").hidden = !isRandom || g_IsController; | ||||
hideControl("numPlayers", "numPlayersText", isRandom && g_IsController); | hideControl("numPlayers", "numPlayersText", isRandom && g_IsController); | ||||
let notScenario = g_GameAttributes.mapType != "scenario" && g_IsController ; | let notScenario = g_GameAttributes.mapType != "scenario" && g_IsController ; | ||||
for (let ctrl of ["victoryCondition", "wonderDuration", "populationCap", | for (let ctrl of ["victoryCondition", "wonderDuration", "populationCap", | ||||
"startingResources", "ceasefire", "revealMap", | "startingResources", "ceasefire", "revealMap", | ||||
"exploreMap", "disableTreasures", "lockTeams", "lastManStanding"]) | "exploreMap", "disableTreasures", "enableSpies", "lockTeams", "lastManStanding"]) | ||||
hideControl(ctrl, ctrl + "Text", notScenario); | hideControl(ctrl, ctrl + "Text", notScenario); | ||||
Engine.GetGUIObjectByName("civResetButton").hidden = !notScenario; | Engine.GetGUIObjectByName("civResetButton").hidden = !notScenario; | ||||
Engine.GetGUIObjectByName("teamResetButton").hidden = !notScenario; | Engine.GetGUIObjectByName("teamResetButton").hidden = !notScenario; | ||||
for (let i = 0; i < g_MaxPlayers; ++i) | for (let i = 0; i < g_MaxPlayers; ++i) | ||||
{ | { | ||||
Engine.GetGUIObjectByName("playerBox["+i+"]").hidden = (i >= numPlayers); | Engine.GetGUIObjectByName("playerBox["+i+"]").hidden = (i >= numPlayers); | ||||
▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator