Differential D3243 Diff 14756 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/ExploredMap.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/ExploredMap.js
GameSettingControls.ExploredMap = class extends GameSettingControlCheckbox | GameSettingControls.ExploredMap = class extends GameSettingControlCheckbox | ||||
{ | { | ||||
onMapChange(mapData) | constructor(...args) | ||||
{ | { | ||||
let mapValue; | super(...args); | ||||
if (mapData && | g_NewGameSettings.mapExploration.setControl(this.gameSettingsControl); | ||||
mapData.settings && | g_NewGameSettings.mapExploration.watch(() => this.render(), ["explored"]); | ||||
mapData.settings.ExploreMap !== undefined) | this.render(); | ||||
mapValue = mapData.settings.ExploreMap; | |||||
if (mapValue !== undefined && mapValue != g_GameAttributes.settings.ExploreMap) | |||||
{ | |||||
g_GameAttributes.settings.ExploreMap = mapValue; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
} | |||||
onGameAttributesChange() | |||||
{ | |||||
if (!g_GameAttributes.mapType) | |||||
return; | |||||
if (g_GameAttributes.settings.ExploreMap === undefined) | |||||
{ | |||||
g_GameAttributes.settings.ExploreMap = !!g_GameAttributes.settings.RevealMap; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
else if (g_GameAttributes.settings.RevealMap && | |||||
!g_GameAttributes.settings.ExploreMap) | |||||
{ | |||||
g_GameAttributes.settings.ExploreMap = true; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
} | } | ||||
onGameAttributesBatchChange() | render() | ||||
{ | { | ||||
if (!g_GameAttributes.mapType) | this.setChecked(g_NewGameSettings.mapExploration.explored); | ||||
return; | |||||
this.setChecked(g_GameAttributes.settings.ExploreMap); | |||||
this.setEnabled(g_GameAttributes.mapType != "scenario" && !g_GameAttributes.settings.RevealMap); | |||||
} | } | ||||
onPress(checked) | onPress(checked) | ||||
{ | { | ||||
g_GameAttributes.settings.ExploreMap = checked; | g_NewGameSettings.mapExploration.setExplored(checked); | ||||
this.gameSettingsControl.updateGameAttributes(); | |||||
this.gameSettingsControl.setNetworkGameAttributes(); | |||||
} | } | ||||
}; | }; | ||||
GameSettingControls.ExploredMap.prototype.TitleCaption = | GameSettingControls.ExploredMap.prototype.TitleCaption = | ||||
// Translation: Make sure to differentiate between the revealed map and explored map settings! | // Translation: Make sure to differentiate between the revealed map and explored map settings! | ||||
translate("Explored Map"); | translate("Explored Map"); | ||||
GameSettingControls.ExploredMap.prototype.Tooltip = | GameSettingControls.ExploredMap.prototype.Tooltip = | ||||
// Translation: Make sure to differentiate between the revealed map and explored map settings! | // Translation: Make sure to differentiate between the revealed map and explored map settings! | ||||
translate("Toggle explored map (see initial map)."); | translate("Toggle explored map (see initial map)."); |
Wildfire Games · Phabricator