Differential D3243 Diff 16503 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/WorldPopulation.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/WorldPopulation.js
GameSettingControls.WorldPopulation = class extends GameSettingControlCheckbox | GameSettingControls.WorldPopulation = class WorldPopulation extends GameSettingControlCheckbox | ||||
{ | { | ||||
onMapChange(mapData) | constructor(...args) | ||||
{ | { | ||||
let mapValue; | super(...args); | ||||
if (mapData && | g_NewGameSettings.population.watch(() => this.render(), ["useWorldPop"]); | ||||
mapData.settings && | g_NewGameSettings.map.watch(() => this.render(), ["type"]); | ||||
mapData.settings.WorldPopulation !== undefined) | this.render(); | ||||
mapValue = mapData.settings.WorldPopulation; | |||||
if (mapValue !== undefined && mapValue != g_GameAttributes.settings.WorldPopulation) | |||||
{ | |||||
g_GameAttributes.settings.WorldPopulation = mapValue; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
this.setEnabled(g_GameAttributes.mapType != "scenario"); | |||||
} | |||||
onGameAttributesChange() | |||||
{ | |||||
if (!g_GameAttributes.mapType) | |||||
return; | |||||
if (g_GameAttributes.settings.WorldPopulation !== undefined) | |||||
return; | |||||
g_GameAttributes.settings.WorldPopulation = false; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | } | ||||
onGameAttributesBatchChange() | render() | ||||
{ | { | ||||
if (!g_GameAttributes.mapType) | this.setEnabled(g_NewGameSettings.map.type != "scenario"); | ||||
return; | this.setChecked(g_NewGameSettings.population.useWorldPop); | ||||
this.setChecked(g_GameAttributes.settings.WorldPopulation); | |||||
} | } | ||||
onPress(checked) | onPress(checked) | ||||
{ | { | ||||
g_GameAttributes.settings.WorldPopulation = checked; | g_NewGameSettings.population.setPopCap(checked); | ||||
this.gameSettingsControl.updateGameAttributes(); | |||||
this.gameSettingsControl.setNetworkGameAttributes(); | this.gameSettingsControl.setNetworkGameAttributes(); | ||||
} | } | ||||
}; | }; | ||||
GameSettingControls.WorldPopulation.prototype.TitleCaption = | GameSettingControls.WorldPopulation.prototype.TitleCaption = | ||||
translate("World population"); | translate("World population"); | ||||
GameSettingControls.WorldPopulation.prototype.Tooltip = | GameSettingControls.WorldPopulation.prototype.Tooltip = | ||||
translate("When checked the Population Cap will be evenly distributed over all living players."); | translate("When checked the Population Cap will be evenly distributed over all living players."); |
Wildfire Games · Phabricator