Differential D2412 Diff 10371 ps/trunk/binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/QuitButton.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/QuitButton.js
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
/** | |||||
* This class manages the button that allows the player to close the lobby page. | |||||
*/ | |||||
class QuitButton | |||||
{ | |||||
constructor(dialog, leaderboardPage, profilePage) | |||||
{ | |||||
let closeDialog = this.closeDialog.bind(this); | |||||
let returnToMainMenu = this.returnToMainMenu.bind(this); | |||||
let onPress = dialog ? closeDialog : returnToMainMenu; | |||||
let leaveButton = Engine.GetGUIObjectByName("leaveButton"); | |||||
leaveButton.onPress = onPress; | |||||
leaveButton.caption = dialog ? | |||||
translateWithContext("previous page", "Back") : | |||||
translateWithContext("previous page", "Main Menu"); | |||||
if (dialog) | |||||
{ | |||||
Engine.SetGlobalHotkey("lobby", onPress); | |||||
Engine.SetGlobalHotkey("cancel", onPress); | |||||
let cancelHotkey = Engine.SetGlobalHotkey.bind(Engine, "cancel", onPress); | |||||
leaderboardPage.registerClosePageHandler(cancelHotkey); | |||||
profilePage.registerClosePageHandler(cancelHotkey); | |||||
} | |||||
} | |||||
closeDialog() | |||||
{ | |||||
Engine.LobbySetPlayerPresence("playing"); | |||||
Engine.PopGuiPage(); | |||||
} | |||||
returnToMainMenu() | |||||
{ | |||||
Engine.StopXmppClient(); | |||||
Engine.SwitchGuiPage("page_pregame.xml"); | |||||
} | |||||
} |
Wildfire Games · Phabricator