Index: binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/HotkeyButton.js =================================================================== --- /dev/null +++ binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/HotkeyButton.js @@ -0,0 +1,17 @@ +/** + * This class manages the button that allows the player to display the hotkey page. + */ +class HotkeyButton +{ + constructor() + { + this.hotkeyButton = Engine.GetGUIObjectByName("hotkeyButton"); + this.hotkeyButton.onPress = this.onPress.bind(this); + this.hotkeyButton.caption = translate("Hotkeys"); + } + + onPress() + { + Engine.PushGuiPage("hotkeys/page_hotkeys.xml"); + } +} Index: binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/LastSummaryButton.js =================================================================== --- /dev/null +++ binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/LastSummaryButton.js @@ -0,0 +1,57 @@ +/** + * This class manages the button that allows the player to display the last summary. + */ +class LastSummaryButton +{ + constructor(dialog) + { + this.lastSummaryButton = Engine.GetGUIObjectByName("lastSummaryButton"); + this.lastSummaryButton.onPress = this.onPress.bind(this); + this.lastSummaryButton.caption = translate("Last Summary"); + this.lastSummaryButton.enabled = !dialog; + } + + onPress() + { + const replays = Engine.GetReplays(false); + if (!replays.length) + { + messageBox(500, 200, translate("No replays data available."), translate("Error")); + return; + } + + const lastReplay = replays.reduce((a, b) => a.attribs.timestamp > b.attribs.timestamp ? a : b); + if (!lastReplay) + { + messageBox(500, 200, translate("No last replay data available."), translate("Error")); + return; + } + + const simData = Engine.GetReplayMetadata(lastReplay.directory); + if (!simData) + { + messageBox(500, 200, translate("No summary data available."), translate("Error")); + return; + } + + const isReplayCompatible = hasSameMods(lastReplay.attribs.mods, Engine.GetEngineInfo().mods); + const gameMods = lastReplay.attribs.mods || []; + if (!isReplayCompatible) + { + messageBox(500, 200, translate("This summary needs a different sequence of mods:") + "\n\n" + + comparedModsString(gameMods, Engine.GetEngineInfo().mods), translate("Incompatible summary")); + return; + } + + Engine.LobbySetPlayerPresence("playing"); + Engine.PushGuiPage("page_summary.xml", { + "sim": simData, + "gui": { + "replayDirectory": lastReplay.directory, + "isInLobby": true, + "ingame": false, + "dialog": true + } + }); + } +} Index: binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/MapBrowserButton.js =================================================================== --- /dev/null +++ binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/MapBrowserButton.js @@ -0,0 +1,17 @@ +/** + * This class manages the button that allows the player to display the map browser page. + */ +class MapBrowserButton +{ + constructor() + { + this.mapBrowserButton = Engine.GetGUIObjectByName("mapBrowserButton"); + this.mapBrowserButton.onPress = this.onPress.bind(this); + this.mapBrowserButton.caption = translate("Maps"); + } + + onPress() + { + Engine.PushGuiPage("page_mapbrowser.xml"); + } +} Index: binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/OptionsButton.js =================================================================== --- /dev/null +++ binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/OptionsButton.js @@ -0,0 +1,17 @@ +/** + * This class manages the button that allows the player to display the options page. + */ +class OptionsButton +{ + constructor() + { + this.optionsButton = Engine.GetGUIObjectByName("optionsButton"); + this.optionsButton.onPress = this.onPress.bind(this); + this.optionsButton.caption = translate("Options"); + } + + onPress() + { + Engine.PushGuiPage("page_options.xml"); + } +} Index: binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/ReplayButton.js =================================================================== --- /dev/null +++ binaries/data/mods/public/gui/lobby/LobbyPage/Buttons/ReplayButton.js @@ -0,0 +1,19 @@ +/** + * This class manages the button that allows the player to display the replay page. + */ +class ReplayButton +{ + constructor(dialog) + { + this.replayButton = Engine.GetGUIObjectByName("replayButton"); + this.replayButton.onPress = this.onPress.bind(this); + this.replayButton.caption = translate("Replay"); + this.replayButton.enabled = !dialog; + } + + onPress() + { + Engine.LobbySetPlayerPresence("playing"); + Engine.PushGuiPage("page_replaymenu.xml"); + } +} Index: binaries/data/mods/public/gui/lobby/LobbyPage/LobbyPage.js =================================================================== --- binaries/data/mods/public/gui/lobby/LobbyPage/LobbyPage.js +++ binaries/data/mods/public/gui/lobby/LobbyPage/LobbyPage.js @@ -16,10 +16,15 @@ "buttons": { "buddyButton": buddyButton, "hostButton": new HostButton(dialog, xmppMessages), + "hotkeyButton": new HotkeyButton(), "joinButton": new JoinButton(dialog, gameList), + "lastSummaryButton": new LastSummaryButton(dialog), "leaderboardButton": new LeaderboardButton(xmppMessages, leaderboardPage), + "mapBrowserButton": new MapBrowserButton(), + "optionsButton": new OptionsButton(), "profileButton": new ProfileButton(xmppMessages, profilePage), - "quitButton": new QuitButton(dialog, leaderboardPage, profilePage) + "quitButton": new QuitButton(dialog, leaderboardPage, profilePage), + "replayButton": new ReplayButton(dialog) }, "panels": { "chatPanel": new ChatPanel(xmppMessages), @@ -31,7 +36,7 @@ }, "eventHandlers": { "announcementHandler": new AnnouncementHandler(xmppMessages), - "connectionHandler": new ConnectionHandler(xmppMessages), + "connectionHandler": new ConnectionHandler(xmppMessages) } }; Index: binaries/data/mods/public/gui/lobby/LobbyPage/LobbyPage.xml =================================================================== --- binaries/data/mods/public/gui/lobby/LobbyPage/LobbyPage.xml +++ binaries/data/mods/public/gui/lobby/LobbyPage/LobbyPage.xml @@ -16,20 +16,20 @@ - + - + - - - + + + - + @@ -39,6 +39,11 @@ + + + + + @@ -48,9 +53,9 @@ - - - + + + Index: binaries/data/mods/public/gui/replaymenu/replay_actions.js =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_actions.js +++ binaries/data/mods/public/gui/replaymenu/replay_actions.js @@ -158,6 +158,16 @@ else deleteReplay(); } + +function closeReplay() +{ + if (Engine.HasXmppClient()) + { + Engine.LobbySetPlayerPresence("available"); + return Engine.PopGuiPage(); + } + return Engine.SwitchGuiPage("page_pregame.xml"); +} /** * Shows a confirmation dialog and deletes the selected replay from the disk in case. */ Index: binaries/data/mods/public/gui/replaymenu/replay_menu.xml =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_menu.xml +++ binaries/data/mods/public/gui/replaymenu/replay_menu.xml @@ -224,8 +224,8 @@ - Main Menu - Engine.SwitchGuiPage("page_pregame.xml"); + Back + closeReplay(); Index: binaries/data/mods/public/gui/summary/summary.js =================================================================== --- binaries/data/mods/public/gui/summary/summary.js +++ binaries/data/mods/public/gui/summary/summary.js @@ -464,6 +464,11 @@ Engine.PopGuiPage({ "summarySelection": summarySelection }); + else if (g_GameData.gui.dialog && Engine.HasXmppClient()) + { + Engine.LobbySetPlayerPresence("available"); + Engine.PopGuiPage(); + } else if (g_GameData.gui.dialog) Engine.PopGuiPage(); else if (Engine.HasXmppClient())