Differential D2483 Diff 10778 binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Nomad.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Nomad.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
GameSettingControls.Nomad = class extends GameSettingControlCheckbox | |||||
{ | |||||
onMapChange(mapData) | |||||
{ | |||||
if (g_GameAttributes.mapType != "random") | |||||
return; | |||||
let mapValue = | |||||
mapData && | |||||
mapData.settings && | |||||
mapData.settings.Nomad; | |||||
if (mapValue !== undefined && mapValue != g_GameAttributes.settings.Nomad) | |||||
{ | |||||
g_GameAttributes.settings.Nomad = mapValue; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
} | |||||
onGameAttributesChange() | |||||
{ | |||||
if (!g_GameAttributes.mapType || !g_GameAttributes.settings) | |||||
return; | |||||
let available = g_GameAttributes.mapType == "random"; | |||||
this.setHidden(!available); | |||||
if (available) | |||||
{ | |||||
if (g_GameAttributes.settings.Nomad === undefined) | |||||
{ | |||||
g_GameAttributes.settings.Nomad = false; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
this.setChecked(g_GameAttributes.settings.Nomad); | |||||
} | |||||
else if (g_GameAttributes.settings.Nomad !== undefined) | |||||
{ | |||||
delete g_GameAttributes.settings.Nomad; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
} | |||||
onPress(checked) | |||||
{ | |||||
g_GameAttributes.settings.Nomad = checked; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
this.gameSettingsControl.setNetworkGameAttributes(); | |||||
} | |||||
}; | |||||
GameSettingControls.Nomad.prototype.TitleCaption = | |||||
translate("Nomad"); | |||||
GameSettingControls.Nomad.prototype.Tooltip = | |||||
translate("In Nomad mode, players start with only few units and have to find a suitable place to build their city. Ceasefire is recommended."); |
Wildfire Games · Phabricator