Differential D3243 Diff 16556 ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/MapSize.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/MapSize.js
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
GameSettings.prototype.Attributes.MapSize = class MapSize extends GameSetting | |||||
{ | |||||
init() | |||||
{ | |||||
this.defaultValue = this.getDefaultValue("MapSizes", "Tiles") || 256; | |||||
this.setSize(this.defaultValue); | |||||
this.settings.map.watch(() => this.onTypeChange(), ["type"]); | |||||
} | |||||
toInitAttributes(attribs) | |||||
{ | |||||
if (this.settings.map.type === "random") | |||||
attribs.settings.Size = this.size; | |||||
} | |||||
fromInitAttributes(attribs) | |||||
{ | |||||
if (!!this.getLegacySetting(attribs, "Size")) | |||||
this.setSize(this.getLegacySetting(attribs, "Size")); | |||||
} | |||||
setSize(size) | |||||
{ | |||||
this.available = this.settings.map.type === "random"; | |||||
this.size = size; | |||||
} | |||||
onTypeChange(old) | |||||
{ | |||||
if (this.settings.map.type === "random" && old !== "random") | |||||
this.setSize(this.defaultValue); | |||||
else if (this.settings.map.type !== "random") | |||||
this.available = false; | |||||
} | |||||
}; |
Wildfire Games · Phabricator