Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -176,6 +176,7 @@ chat = Return ; Toggle chat window teamchat = "T" ; Toggle chat window in team chat mode privatechat = "L" ; Toggle chat window and select the previous private chat partner +lobby = "Alt+L" ; Show the multiplayer lobby. ; > QUICKSAVE quicksave = "Shift+F5" Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js =================================================================== --- binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -909,6 +909,11 @@ translate("Return to the lobby.") : translate("Return to the main menu."), }, + "lobbyButton": { + "tooltip": () => + translate("Show the multiplayer lobby in a dialog window."), + "hidden": () => !Engine.HasXmppClient(), + }, "startGame": { "caption": () => g_IsController ? translate("Start Game!") : g_ReadyData[g_IsReady].caption, Index: binaries/data/mods/public/gui/gamesetup/gamesetup.xml =================================================================== --- binaries/data/mods/public/gui/gamesetup/gamesetup.xml +++ binaries/data/mods/public/gui/gamesetup/gamesetup.xml @@ -247,6 +247,17 @@ + + + Engine.PushGuiPage("page_lobby.xml", { "dialog": true }); + OK Close more game options window - showMoreOptions(false); + showMoreOptions(false);warn("ok") Index: binaries/data/mods/public/gui/gamesetup/sprites.xml =================================================================== --- binaries/data/mods/public/gui/gamesetup/sprites.xml +++ binaries/data/mods/public/gui/gamesetup/sprites.xml @@ -8,4 +8,18 @@ /> + + + + + + + + Index: binaries/data/mods/public/gui/lobby/lobby.js =================================================================== --- binaries/data/mods/public/gui/lobby/lobby.js +++ binaries/data/mods/public/gui/lobby/lobby.js @@ -88,7 +88,7 @@ /** * All games currently running. */ -var g_GameList = {}; +var g_GameList = []; /** * Used to restore the selection after updating the playerlist. @@ -121,7 +121,6 @@ "registered": msg => false, "connected": msg => false, "disconnected": msg => { - updateGameList(); updateLeaderboard(); @@ -363,12 +362,18 @@ "quit": { "description": translate("Return to the main menu."), "handler": args => { - returnToMainMenu(); + leaveLobby(); return false; } } }; +/* + * Indicates, if lobby is opened in a dialog. + */ +var g_Dialog = false; + + /** * Called after the XmppConnection succeeded and when returning from a game. * @@ -376,9 +381,25 @@ */ function init(attribs) { + g_Dialog = attribs && !!attribs.dialog; + setupSummaryWindowStyle(g_Dialog); + if (g_Dialog) + { + Engine.GetGUIObjectByName("cancelDialog").onPress = () => leaveLobby(); + Engine.GetGUIObjectByName("hostButton").hidden = true; + Engine.GetGUIObjectByName("joinGameButton").hidden = true; + Engine.GetGUIObjectByName("gameInfoEmpty").size = "0 0 100% 100%-30"; + Engine.GetGUIObjectByName("gameInfo").size = "0 0 100% 100%-30"; + Engine.GetGUIObjectByName("leaveButton").caption = translate("Back"); + Engine.LobbySetPlayerPresence("away"); // Get gamelist updates while not status available + } + else + // only when not opened dialog + Engine.LobbySetPlayerPresence("available"); + if (!g_Settings) { - returnToMainMenu(); + leaveLobby(); return; } @@ -387,8 +408,6 @@ initGameFilters(); - Engine.LobbySetPlayerPresence("available"); - // When rejoining the lobby after a game, we don't need to process presence changes Engine.LobbyClearPresenceUpdates(); updatePlayerList(); @@ -399,10 +418,22 @@ Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey(); // Get all messages since the login - for (let msg of Engine.LobbyGuiPollHistoricMessages()) + for (let msg of Engine.LobbyGuiPollHistoricMessages() || []) g_NetMessageTypes[msg.type][msg.level](msg); } +/** + * Set sprite of the window and size of the window and the window title. + * @param {boolean} dialog - True, set dialog size and sprite, false set for window. + */ +function setupSummaryWindowStyle(dialog) +{ + let window = Engine.GetGUIObjectByName("lobbyWindow"); + window.sprite = dialog ? "ModernDialog" : "ModernWindow"; + window.size = dialog ? "16 24 100%-16 100%-24" : "0 0 100% 100%"; + Engine.GetGUIObjectByName("lobbyWindowTitle").size = dialog ? "50%-128 -16 50%+128 16" : "50%-128 4 50%+128 36"; +} + function updateLobbyColumns() { let gameRating = Engine.ConfigDB_GetValue("user", "lobby.columns.gamerating") == "true"; @@ -426,10 +457,19 @@ playersNumberFilter.size = size; } -function returnToMainMenu() +function leaveLobby() { - Engine.StopXmppClient(); - Engine.SwitchGuiPage("page_pregame.xml"); + if (g_Dialog) + { + Engine.LobbySetPlayerPresence("playing"); + Engine.PopGuiPage(); + } + else + { + if (Engine.HasXmppClient()) + Engine.StopXmppClient(); + Engine.SwitchGuiPage("page_pregame.xml"); + } } function initGameFilters() @@ -611,7 +651,7 @@ let nickList = []; let ratingList = []; - let cleanPlayerList = Engine.GetPlayerList().map(player => { + let cleanPlayerList = (Engine.GetPlayerList() || []).map(player => { player.isBuddy = g_Buddies.indexOf(player.name) != -1; return player; }).sort((a, b) => { @@ -903,7 +943,7 @@ g_SelectedGamePort = g_GameList[gamesBox.selected].port; } - g_GameList = Engine.GetGameList().map(game => { + g_GameList = (Engine.GetGameList() || g_GameList).map(game => { game.hasBuddies = 0; @@ -1015,7 +1055,7 @@ let game = selectedGame(); Engine.GetGUIObjectByName("gameInfo").hidden = !game; - Engine.GetGUIObjectByName("joinGameButton").hidden = !game; + Engine.GetGUIObjectByName("joinGameButton").hidden = g_Dialog || !game; Engine.GetGUIObjectByName("gameInfoEmpty").hidden = game; if (!game) @@ -1073,7 +1113,7 @@ function joinButton() { let game = selectedGame(); - if (!game) + if (!game || g_Dialog) return; let rating = getRejoinRating(game); Index: binaries/data/mods/public/gui/lobby/lobby.xml =================================================================== --- binaries/data/mods/public/gui/lobby/lobby.xml +++ binaries/data/mods/public/gui/lobby/lobby.xml @@ -7,7 +7,7 @@ - + Multiplayer Lobby Index: binaries/data/mods/public/gui/lobby/lobby_panels.xml =================================================================== --- binaries/data/mods/public/gui/lobby/lobby_panels.xml +++ binaries/data/mods/public/gui/lobby/lobby_panels.xml @@ -6,6 +6,8 @@ onTick(); + + Leaderboard - setLeaderboardVisibility(true); User Profile Lookup - setUserProfileVisibility(true); @@ -164,9 +164,9 @@ - + Main Menu - returnToMainMenu(); + leaveLobby(); Index: binaries/data/mods/public/gui/manual/intro.txt =================================================================== --- binaries/data/mods/public/gui/manual/intro.txt +++ binaries/data/mods/public/gui/manual/intro.txt @@ -49,6 +49,7 @@ Shift + F11: Save current profiler data to "logs/profile.txt" F2: Take screenshot (in .png format, location is displayed in the top left of the GUI after the file has been saved, and can also be seen in the console/logs if you miss it there) Shift + F2: Take huge screenshot (6400px*4800px, in .bmp format, location is displayed in the top left of the GUI after the file has been saved, and can also be seen in the console/logs if you miss it there) +Alt + L: Open the multiplayer lobby. Alt + S: Switch to the next tab. Alt + W: Switch to the previous tab. Index: binaries/data/mods/public/gui/pregame/mainmenu.xml =================================================================== --- binaries/data/mods/public/gui/pregame/mainmenu.xml +++ binaries/data/mods/public/gui/pregame/mainmenu.xml @@ -291,6 +291,7 @@ style="StoneButtonFancy" size="0 64 100% 92" tooltip_style="pgToolTip" + hotkey="lobby" > Game Lobby Launch the multiplayer lobby. Index: binaries/data/mods/public/gui/session/menu.js =================================================================== --- binaries/data/mods/public/gui/session/menu.js +++ binaries/data/mods/public/gui/session/menu.js @@ -2,7 +2,7 @@ var MARGIN = 4; // Includes the main menu button -const NUM_BUTTONS = 9; +const NUM_BUTTONS = 10; // Regular menu buttons var BUTTON_HEIGHT = 32; @@ -239,6 +239,13 @@ }); } +function openLobby() +{ + closeOpenDialogs(); + + Engine.PushGuiPage("page_lobby.xml", { "dialog": true }); +} + function openChat(command = "") { if (g_Disconnected) Index: binaries/data/mods/public/gui/session/menu.xml =================================================================== --- binaries/data/mods/public/gui/session/menu.xml +++ binaries/data/mods/public/gui/session/menu.xml @@ -86,11 +86,24 @@ resignMenuButton(); + + + Show Lobby + Show the multiplayer lobby in a dialog window. + openLobby(); + + Exit Index: binaries/data/mods/public/gui/session/session.js =================================================================== --- binaries/data/mods/public/gui/session/session.js +++ binaries/data/mods/public/gui/session/session.js @@ -624,6 +624,7 @@ Engine.GetGUIObjectByName("pauseButton").enabled = !g_IsObserver || !g_IsNetworked || g_IsController; Engine.GetGUIObjectByName("menuResignButton").enabled = !g_IsObserver; + Engine.GetGUIObjectByName("lobbyButton").enabled = Engine.HasXmppClient(); } function reportPerformance(time) Index: binaries/data/mods/public/gui/summary/summary.xml =================================================================== --- binaries/data/mods/public/gui/summary/summary.xml +++ binaries/data/mods/public/gui/summary/summary.xml @@ -24,6 +24,13 @@ selectNextTab(-1); + + + if (Engine.HasXmppClient) + Engine.PushGuiPage("page_lobby.xml", { "dialog": true }); + + +