Differential D3715 Diff 16588 ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/PlayerTeam.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/PlayerTeam.js
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | while (this.values.length < nb) | ||||
// -1 is None | // -1 is None | ||||
this.values.push(-1); | this.values.push(-1); | ||||
this.locked.push(false); | this.locked.push(false); | ||||
} | } | ||||
} | } | ||||
onMapChange() | onMapChange() | ||||
{ | { | ||||
this.locked = this.locked.map(x => this.settings.map.type === "scenario"); | |||||
this.trigger("locked"); | |||||
if (this.settings.map.type === "random") | if (this.settings.map.type === "random") | ||||
return; | return; | ||||
let pData = this.getMapSetting("PlayerData"); | let pData = this.getMapSetting("PlayerData"); | ||||
if (pData && pData.every(x => x.Team === undefined)) | if (pData && pData.every(x => x.Team === undefined)) | ||||
return; | return; | ||||
for (let p in pData) | for (let p in pData) | ||||
this._set(+p, pData[p].Team === undefined ? -1 : pData[p].Team); | this._set(+p, pData[p].Team === undefined ? -1 : pData[p].Team); | ||||
this.trigger("values"); | this.trigger("values"); | ||||
} | } | ||||
maybeUpdate() | maybeUpdate() | ||||
{ | { | ||||
this._resize(this.settings.playerCount.nbPlayers); | this._resize(this.settings.playerCount.nbPlayers); | ||||
this.values.forEach((c, i) => this._set(i, c)); | this.values.forEach((c, i) => this._set(i, c)); | ||||
this.trigger("values"); | this.trigger("values"); | ||||
} | } | ||||
_set(playerIndex, value) | _set(playerIndex, value) | ||||
{ | { | ||||
this.values[playerIndex] = value; | this.values[playerIndex] = value; | ||||
this.locked[playerIndex] = this.settings.map.type == "scenario"; | |||||
} | } | ||||
setValue(playerIndex, val) | setValue(playerIndex, val) | ||||
{ | { | ||||
this._set(playerIndex, val); | this._set(playerIndex, val); | ||||
this.trigger("values"); | this.trigger("values"); | ||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator