Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/HostButton.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
/** | |||||
* This class manages the button that enables the player to configure the start a new hosted multiplayer match. | |||||
*/ | |||||
class HostButton | |||||
{ | |||||
constructor(dialog, xmppMessages) | |||||
{ | |||||
this.hostButton = Engine.GetGUIObjectByName("hostButton"); | |||||
this.hostButton.onPress = this.onPress.bind(this); | |||||
this.hostButton.caption = translate("Host Game"); | |||||
this.hostButton.hidden = dialog; | |||||
let onConnectionStatusChange = this.onConnectionStatusChange.bind(this); | |||||
xmppMessages.registerHandler("system", "connected", onConnectionStatusChange); | |||||
xmppMessages.registerHandler("system", "disconnected", onConnectionStatusChange); | |||||
} | |||||
onConnectionStatusChange() | |||||
{ | |||||
this.hostButton.enabled = Engine.IsXmppClientConnected(); | |||||
} | |||||
onPress() | |||||
{ | |||||
Engine.PushGuiPage("page_gamesetup_mp.xml", { | |||||
"multiplayerGameType": "host", | |||||
"name": g_Username, | |||||
"rating": Engine.LobbyGetPlayerRating(g_Username) | |||||
}); | |||||
} | |||||
} |
Wildfire Games · Phabricator