Differential D3243 Diff 16556 ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/Rating.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/gamesettings/attributes/Rating.js
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
GameSettings.prototype.Attributes.Rating = class Rating extends GameSetting | |||||
{ | |||||
init() | |||||
{ | |||||
this.hasXmppClient = Engine.HasXmppClient(); | |||||
this.settings.playerCount.watch(() => this.maybeUpdate(), ["nbPlayers"]); | |||||
this.maybeUpdate(); | |||||
} | |||||
toInitAttributes(attribs) | |||||
{ | |||||
if (this.available) | |||||
attribs.settings.RatingEnabled = this.enabled; | |||||
} | |||||
fromInitAttributes(attribs) | |||||
{ | |||||
if (this.getLegacySetting(attribs, "RatingEnabled")) | |||||
{ | |||||
this.available = this.hasXmppClient && this.settings.playerCount.nbPlayers === 2; | |||||
this.enabled = this.available && !!this.getLegacySetting(attribs, "RatingEnabled"); | |||||
} | |||||
} | |||||
setEnabled(enabled) | |||||
{ | |||||
this.enabled = this.available && enabled; | |||||
} | |||||
maybeUpdate() | |||||
{ | |||||
// This setting is activated by default if it's possible. | |||||
this.available = this.hasXmppClient && this.settings.playerCount.nbPlayers === 2; | |||||
this.enabled = this.available; | |||||
} | |||||
}; |
Wildfire Games · Phabricator