diff --git a/modules/client_topmenu/topmenu.lua b/modules/client_topmenu/topmenu.lua index a11fa587..bb8632f9 100644 --- a/modules/client_topmenu/topmenu.lua +++ b/modules/client_topmenu/topmenu.lua @@ -51,6 +51,8 @@ function init() pingLabel = topMenu:getChildById('pingLabel') fpsLabel = topMenu:getChildById('fpsLabel') + g_keyboard.bindKeyDown('Ctrl+Shift+T', toggle) + if g_game.isOnline() then online() end @@ -164,3 +166,22 @@ end function getTopMenu() return topMenu end + +function toggle() + local menu = getTopMenu() + if not menu then + return + end + + if menu:isVisible() then + menu:hide() + modules.client_background.getBackground():addAnchor(AnchorTop, 'parent', AnchorTop) + modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'parent', AnchorTop) + modules.game_interface.getShowTopMenuButton():show() + else + menu:show() + modules.client_background.getBackground():addAnchor(AnchorTop, 'topMenu', AnchorBottom) + modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom) + modules.game_interface.getShowTopMenuButton():hide() + end +end diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 490da3ee..fa9d4799 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -5,6 +5,7 @@ gameMapPanel = nil gameRightPanel = nil gameLeftPanel = nil gameBottomPanel = nil +showTopMenuButton = nil logoutButton = nil mouseGrabberWidget = nil countWindow = nil @@ -56,6 +57,11 @@ function init() logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'), '/images/topbuttons/logout', tryLogout, true) + showTopMenuButton = gameMapPanel:getChildById('showTopMenuButton') + showTopMenuButton.onClick = function() + modules.client_topmenu.toggle() + end + setupViewMode(0) bindKeys() @@ -815,6 +821,10 @@ function getBottomPanel() return gameBottomPanel end +function getShowTopMenuButton() + return showTopMenuButton +end + function onLeftPanelVisibilityChange(leftPanel, visible) if not visible and g_game.isOnline() then local children = leftPanel:getChildren() diff --git a/modules/game_interface/gameinterface.otui b/modules/game_interface/gameinterface.otui index 9196a223..7be46a07 100644 --- a/modules/game_interface/gameinterface.otui +++ b/modules/game_interface/gameinterface.otui @@ -1,4 +1,3 @@ - GameSidePanel < UIMiniWindowContainer image-source: /images/ui/panel_side image-border: 4 @@ -33,6 +32,14 @@ UIWidget anchors.bottom: gameBottomPanel.top focusable: false + Button + id: showTopMenuButton + anchors.top: parent.top + anchors.left: parent.left + !text: tr('Show Top Menu') + height: 32 + visible: false + GameBottomPanel id: gameBottomPanel anchors.left: gameLeftPanel.right @@ -73,4 +80,4 @@ UIWidget UIWidget id: mouseGrabber focusable: false - visible: false \ No newline at end of file + visible: false