Differential D3243 Diff 14756 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RevealedMap.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RevealedMap.js
GameSettingControls.RevealedMap = class extends GameSettingControlCheckbox | GameSettingControls.RevealedMap = class extends GameSettingControlCheckbox | ||||
{ | { | ||||
onMapChange(mapData) | constructor(...args) | ||||
{ | { | ||||
let mapValue; | super(...args); | ||||
if (mapData && | g_NewGameSettings.mapExploration.watch(() => this.render(), ["revealed"]); | ||||
mapData.settings && | this.render(); | ||||
mapData.settings.RevealMap !== undefined) | |||||
mapValue = mapData.settings.RevealMap; | |||||
if (mapValue !== undefined && mapValue != g_GameAttributes.settings.RevealMap) | |||||
{ | |||||
g_GameAttributes.settings.RevealMap = mapValue; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
this.setEnabled(g_GameAttributes.mapType != "scenario"); | |||||
} | } | ||||
onGameAttributesChange() | render() | ||||
{ | |||||
if (!g_GameAttributes.mapType) | |||||
return; | |||||
if (g_GameAttributes.settings.RevealMap === undefined) | |||||
{ | { | ||||
g_GameAttributes.settings.RevealMap = false; | this.setChecked(g_NewGameSettings.mapExploration.revealed); | ||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
} | |||||
onGameAttributesBatchChange() | |||||
{ | |||||
if (!g_GameAttributes.mapType) | |||||
return; | |||||
this.setChecked(g_GameAttributes.settings.RevealMap); | |||||
} | } | ||||
onPress(checked) | onPress(checked) | ||||
{ | { | ||||
g_GameAttributes.settings.RevealMap = checked; | g_NewGameSettings.mapExploration.setRevealed(checked); | ||||
this.gameSettingsControl.updateGameAttributes(); | |||||
this.gameSettingsControl.setNetworkGameAttributes(); | |||||
} | } | ||||
}; | }; | ||||
GameSettingControls.RevealedMap.prototype.TitleCaption = | GameSettingControls.RevealedMap.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("Revealed Map"); | translate("Revealed Map"); | ||||
GameSettingControls.RevealedMap.prototype.Tooltip = | GameSettingControls.RevealedMap.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 revealed map (see everything)."); | translate("Toggle revealed map (see everything)."); |
Wildfire Games · Phabricator