Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -344,6 +344,9 @@ cursorblinkrate = 0.5 ; Cursor blink rate in seconds (0.0 to disable blinking) scale = 1.0 ; GUI scaling factor, for improved compatibility with 4K displays +[gui.lobby] +morebuttonsbar = "hiding" ; Show more buttons bar below chat input "disabled", "hiding" or "visible". + [gui.gamesetup] enabletips = true ; Enable/Disable tips during gamesetup (for newcomers) assignplayers = everyone ; Whether to assign joining clients to free playerslots. Possible values: everyone, buddies, disabled. 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 @@ -188,14 +188,14 @@ - + - + submitChatInput(); autoCompleteNick(this, g_Autocomplete); - + Send submitChatInput(); 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 @@ -110,6 +110,19 @@ */ var g_Kicked = false; +/* + * List of more buttons bar shown below chat input, when mouse hovering there. + */ +var g_MoreButtonsBar = [ + { "text": "Replays", "func": () => Engine.SwitchGuiPage("page_replaymenu.xml") }, + { "text": "Last Summary", "func": () => lastSummary() }, + { "text": "Civilizations", "func": () => Engine.PushGuiPage("page_structree.xml") }, + { "text": "Options", "func": () => Engine.PushGuiPage("page_options.xml", { + "selectedCategory": "Lobby", + "callback": "initConfigurables" + })} +]; + /** * Processing of notifications sent by XmppClient.cpp. * @@ -393,7 +406,7 @@ Engine.LobbyClearPresenceUpdates(); updatePlayerList(); updateSubject(Engine.LobbyGetRoomSubject()); - updateLobbyColumns(); + initConfigurables(); updateToggleBuddy(); Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey(); @@ -403,6 +416,53 @@ g_NetMessageTypes[msg.type][msg.level](msg); } +function initConfigurables() +{ + updateLobbyColumns(); + initAutoHiddenButtons(); +} + +function initAutoHiddenButtons() +{ + let showConfig = Engine.ConfigDB_GetValue("user", "gui.lobby.morebuttonsbar"); + + let autoHideArea = Engine.GetGUIObjectByName("moreOptionsBarActionHide"); + let autoShowArea = Engine.GetGUIObjectByName("moreOptionsBarActionShow"); + + autoHideArea.onmouseenter = () => true; + autoShowArea.onmouseenter = () => true; + + if (showConfig == "hiding") + { + autoHideArea.onmouseenter = () => showHiddenButtons(false); + autoShowArea.onmouseenter = () => showHiddenButtons(true); + } + + showHiddenButtons(showConfig == "visible"); + + if (showConfig == "disabled") + return; + + let butWidthPercent = (1 / g_MoreButtonsBar.length) * 100; + + for (let i in g_MoreButtonsBar) + { + let but = Engine.GetGUIObjectByName("moreButtons[" + i + "]"); + but.hidden = false; + // Let gap "+2" between buttons and calculate size to fit space + but.size = i * butWidthPercent + "%" + (i > 0 ? "+2" : "") + " 100%-25 " + ((+i + 1) * butWidthPercent) + "%" + " 100%"; + but.caption = g_MoreButtonsBar[i].text; + but.onpress = g_MoreButtonsBar[i].func; + } +} + +function showHiddenButtons(show) +{ + Engine.GetGUIObjectByName("moreOptionsBarActionHide").hidden = !show; + Engine.GetGUIObjectByName("chatPanel").size = show ? "0 49% 100% 100%-29" : "0 49% 100% 100%" + Engine.GetGUIObjectByName("moreButtons").hidden = !show; +} + function updateLobbyColumns() { let gameRating = Engine.ConfigDB_GetValue("user", "lobby.columns.gamerating") == "true"; 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 @@ -7,7 +7,7 @@ - + - +