Differential D3243 Diff 16556 ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/Ceasefire.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/Ceasefire.js
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
GameSettings.prototype.Attributes.Ceasefire = class Ceasefire extends GameSetting | |||||
{ | |||||
init() | |||||
{ | |||||
this.value = 0; | |||||
this.settings.map.watch(() => this.onMapChange(), ["map"]); | |||||
} | |||||
toInitAttributes(attribs) | |||||
{ | |||||
if (!this.value) | |||||
return; | |||||
attribs.settings.Ceasefire = this.value; | |||||
} | |||||
fromInitAttributes(attribs) | |||||
{ | |||||
if (!this.getLegacySetting(attribs, "Ceasefire")) | |||||
this.value = 0; | |||||
else | |||||
this.value = +this.getLegacySetting(attribs, "Ceasefire"); | |||||
} | |||||
onMapChange() | |||||
{ | |||||
if (this.settings.map.type != "scenario") | |||||
return; | |||||
if (!this.getMapSetting("Ceasefire")) | |||||
this.value = 0; | |||||
else | |||||
this.value = +this.getMapSetting("Ceasefire"); | |||||
} | |||||
setValue(val) | |||||
{ | |||||
this.value = Math.round(val); | |||||
} | |||||
}; |
Wildfire Games · Phabricator