Differential D2483 Diff 10823 binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Rating.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Rating.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
GameSettingControls.Rating = class extends GameSettingControlCheckbox | |||||
{ | |||||
constructor(...args) | |||||
{ | |||||
super(...args); | |||||
this.hasXmppClient = Engine.HasXmppClient(); | |||||
} | |||||
onGameAttributesChange() | |||||
{ | |||||
let available = this.hasXmppClient && g_GameAttributes.settings.PlayerData.length == 2; | |||||
this.setHidden(!available); | |||||
if (available) | |||||
{ | |||||
if (g_GameAttributes.settings.RatingEnabled === undefined) | |||||
{ | |||||
g_GameAttributes.settings.RatingEnabled = true; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
this.setChecked(g_GameAttributes.settings.RatingEnabled); | |||||
} | |||||
else if (g_GameAttributes.settings.RatingEnabled !== undefined) | |||||
{ | |||||
delete g_GameAttributes.settings.RatingEnabled; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
} | |||||
onPress(checked) | |||||
{ | |||||
g_GameAttributes.settings.RatingEnabled = checked; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
this.gameSettingsControl.setNetworkGameAttributes(); | |||||
} | |||||
onGameAttributesFinalize() | |||||
{ | |||||
if (this.hasXmppClient) | |||||
Engine.SetRankedGame(!!g_GameAttributes.settings.RatingEnabled); | |||||
} | |||||
}; | |||||
GameSettingControls.Rating.prototype.TitleCaption = | |||||
translate("Rated Game"); | |||||
GameSettingControls.Rating.prototype.Tooltip = | |||||
translate("Toggle if this game will be rated for the leaderboard."); |
Wildfire Games · Phabricator