Differential D3243 Diff 16499 binaries/data/mods/public/gui/gamesettings/attributes/MapExploration.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesettings/attributes/MapExploration.js
- This file was added.
GameSettings.prototype.Attributes.MapExploration = class MapExploration extends GameSetting | |||||
{ | |||||
Init() | |||||
{ | |||||
this.explored = false; | |||||
this.revealed = false; | |||||
this.settings.map.watch(() => this.onMapChange(), ["map"]); | |||||
} | |||||
LegacySerialize(attribs) | |||||
{ | |||||
attribs.settings.RevealMap = this.revealed; | |||||
attribs.settings.ExploreMap = this.explored; | |||||
} | |||||
LegacyDeserialize(attribs) | |||||
{ | |||||
this.explored = !!this.getLegacySetting(attribs, "ExploreMap"); | |||||
this.revealed = !!this.getLegacySetting(attribs, "RevealMap"); | |||||
} | |||||
onMapChange(mapData) | |||||
{ | |||||
if (this.settings.map.type != "scenario") | |||||
return; | |||||
this.setExplored(this.getMapSetting("ExploreMap")); | |||||
this.setRevealed(this.getMapSetting("RevealMap")); | |||||
} | |||||
setExplored(enabled) | |||||
{ | |||||
this.explored = enabled; | |||||
this.revealed = this.revealed && this.explored; | |||||
} | |||||
setRevealed(enabled) | |||||
{ | |||||
this.explored = this.explored || enabled; | |||||
this.revealed = enabled; | |||||
} | |||||
}; |
Wildfire Games · Phabricator