Differential D4240 Diff 19682 ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/GameSpeed.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/GameSpeed.js
GameSettings.prototype.Attributes.GameSpeed = class GameSpeed extends GameSetting | GameSettings.prototype.Attributes.GameSpeed = class GameSpeed extends GameSetting | ||||
{ | { | ||||
init() | init() | ||||
{ | { | ||||
this.gameSpeed = 1; | this.gameSpeed = 1; | ||||
this.settings.map.watch(() => this.onMapChange(), ["map"]); | this.settings.map.watch(() => this.onMapChange(), ["map"]); | ||||
} | } | ||||
toInitAttributes(attribs) | toInitAttributes(attribs) | ||||
{ | { | ||||
attribs.gameSpeed = +this.gameSpeed; | attribs.gameSpeed = +this.gameSpeed; | ||||
} | } | ||||
fromInitAttributes(attribs) | fromInitAttributes(attribs) | ||||
{ | { | ||||
if (!attribs.gameSpeed) | if (attribs.gameSpeed) | ||||
return; | |||||
this.gameSpeed = +attribs.gameSpeed; | this.gameSpeed = +attribs.gameSpeed; | ||||
} | } | ||||
onMapChange() | onMapChange() | ||||
{ | { | ||||
if (!this.getMapSetting("gameSpeed")) | if (!this.getMapSetting("gameSpeed")) | ||||
return; | return; | ||||
this.setSpeed(+this.getMapSetting("gameSpeed")); | this.setSpeed(+this.getMapSetting("gameSpeed")); | ||||
} | } | ||||
setSpeed(speed) | setSpeed(speed) | ||||
{ | { | ||||
this.gameSpeed = +speed; | this.gameSpeed = +speed; | ||||
} | } | ||||
}; | }; |
Wildfire Games · Phabricator