From ddaff8a46a6a09e8d3083fb99c528f66ac6321e9 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Fri, 18 Jan 2013 05:53:41 +0000 Subject: [PATCH] Remove exit module, logout no longer at miniwindow side, always visible --- modules/client/client.otmod | 1 - modules/client_exit/exit.lua | 65 ------------------ modules/client_exit/exit.otmod | 16 ----- modules/client_exit/exit.otui | 0 modules/client_exit/exit.png | Bin 733 -> 0 bytes .../skins/default/images/logout.png | Bin 385 -> 381 bytes modules/client_topmenu/topmenu.lua | 41 ++++++----- modules/game_interface/gameinterface.lua | 9 +-- 8 files changed, 28 insertions(+), 104 deletions(-) delete mode 100644 modules/client_exit/exit.lua delete mode 100644 modules/client_exit/exit.otmod delete mode 100644 modules/client_exit/exit.otui delete mode 100644 modules/client_exit/exit.png diff --git a/modules/client/client.otmod b/modules/client/client.otmod index 539e794f..3d002798 100644 --- a/modules/client/client.otmod +++ b/modules/client/client.otmod @@ -19,6 +19,5 @@ Module - client_options - client_terminal - client_modulemanager - - client_exit //- client_stats diff --git a/modules/client_exit/exit.lua b/modules/client_exit/exit.lua deleted file mode 100644 index 2859f1bf..00000000 --- a/modules/client_exit/exit.lua +++ /dev/null @@ -1,65 +0,0 @@ -Exit = {} - -local exitWindow -local exitButton - -function Exit.init() - exitButton = TopMenu.addRightButton('exitButton', tr('Exit Client'), 'exit.png', Exit.tryExit) - - if g_game.isOnline() then - exitButton:hide() - else - exitButton:show() - end - - connect(g_game, { - onGameStart = Exit.hide, - onGameEnd = Exit.show - }) -end - -function Exit.terminate() - disconnect(g_game, { - onGameStart = Exit.hide, - onGameEnd = Exit.show - }) - - if exitWindow then - exitWindow:destroy() - exitWindow = nil - end - - if exitButton then - exitButton:destroy() - exitButton = nil - end - - Exit = nil -end - -function Exit.hide() - if exitWindow then - exitWindow:destroy() - end - exitButton:hide() -end - -function Exit.show() - exitButton:show() -end - -function Exit.tryExit() - if exitWindow then - return true - end - - local yesFunc = function() scheduleEvent(exit, 10) end - local noFunc = function() exitWindow:destroy() exitWindow = nil end - - exitWindow = displayGeneralBox('Exit', tr("Do you really want to exit?"), - { { text='Yes', callback=yesFunc }, - { text='No', callback=noFunc }, - anchor=AnchorHorizontalCenter }, yesFunc, noFunc) - - return true -end diff --git a/modules/client_exit/exit.otmod b/modules/client_exit/exit.otmod deleted file mode 100644 index 80afc3b8..00000000 --- a/modules/client_exit/exit.otmod +++ /dev/null @@ -1,16 +0,0 @@ -Module - name: client_exit - description: Handles the exit exit of the client (for cases of fullscreen) - author: BeniS - website: www.otclient.info - - dependencies: - - client_topmenu - - client_entergame - - @onLoad: | - dofile 'exit' - Exit.init() - - @onUnload: | - Exit.terminate() diff --git a/modules/client_exit/exit.otui b/modules/client_exit/exit.otui deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/client_exit/exit.png b/modules/client_exit/exit.png deleted file mode 100644 index 1512fab2091955c6e79debbcde155bbb333397d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 733 zcmV<30wVp1P)- z`EU-0pRlPuKKi0&RYU|;{jV=ZAuC9M$x4)xBd5+uxfuu)yn5&m);YZQ#29hj;;kbD zM{thdEPq|S0>Bnv*maE8*ZJtwhupuj=DB?@VSU5rUw*}d_YGOye}Jpk{vq5P0bn)* zu3ym=%CuKfEY|4qkSQ5o8Q3wTSl-SkCvF6LcR(p=rnfN0&>JpLRTb0G7%7BpMW3=z z+VL&Cb$17hBxaK-hJw24A)++12}qA}SRh4-wU(}Hw*q^P?NP-ro{lIhL%$v%BFx4& z=~Y5qmKbB0wNrwdpCJDS_P(`SB@36{{(*CAuVbwxr9euFS#ac#@maw&jK&QozWZA? zY%nPbzFs@SqbHu`kH+$+&Fp&W8Lo#&)7!y#;U1n`eV*17jQ<@iA3OHAYJzAJIVHaN z^#gufJI&ssFY|_7Vr6*=?|yR56fE@zEcR=V2^TMain^Av6nu&Z z75za)Dd08Y?*M})aOKi<@P>qN;Mo;?Eu1|4E$^-DqM8O4TE}9!jbVab>*#lhp$l8T z@X(vPb#>n(TsZ$b2Pc7iXH`waq(DX!sKBJLeD?E=jbVx@bK(4NyfSjcoJlB>m7EPp z0utvbjS*s+&ujoR!O8va;;qA{i0@|1>^yyK*I-?uZ98K0l--Pj53Ak=X;EE4AvW7I P00000NkvXXu0mjfB*9k# diff --git a/modules/client_skins/skins/default/images/logout.png b/modules/client_skins/skins/default/images/logout.png index 12aa0dc0f00831b7fc91ee505369e242bc148279..91e2354c9078f201913a56ced0c2827c378f9c16 100644 GIT binary patch delta 287 zcmV+)0pR|D1N{P!Bo78+OGiWi{{a60|De66laW9k3f%z`1uO=0ogamfXe@u>NklByu48yC4faGofmSs66($3!dLkXfuTo29D zG`+_d`#q5KA0UMAY>c@9AW3-d52|`jhV<6j3jqEC2--*Sy1aD7cjDERP7pSC2&$CGVRaMOOLI?){2>`StU}mGcAHPh!hN@n-(v=g~ zb={kYJZ`Odr6mIaNZYm#Bu_u?Ul&;5VHh4&^}N*QdCqR4TVQuT_I>}dc;fEN{sGA> zT-Wuhh>)bDly+t|iU@xR#2EL}G+lD=CKJtUB>B7*F1@hC822Ov|03Q2uE};?EZnNR P00000NkvXXu0mjf-LHUU diff --git a/modules/client_topmenu/topmenu.lua b/modules/client_topmenu/topmenu.lua index ec616f74..1cf96bd5 100644 --- a/modules/client_topmenu/topmenu.lua +++ b/modules/client_topmenu/topmenu.lua @@ -8,7 +8,7 @@ local leftGameButtonsPanel local rightGameButtonsPanel -- private functions -local function addButton(id, description, icon, callback, panel, toggle) +local function addButton(id, description, icon, callback, panel, toggle, front) local class if toggle then class = 'TopToggleButton' @@ -16,7 +16,12 @@ local function addButton(id, description, icon, callback, panel, toggle) class = 'TopButton' end - local button = g_ui.createWidget(class, panel) + local button = g_ui.createWidget(class) + if front then + panel:insertChild(1, button) + else + panel:addChild(button) + end button:setId(id) button:setTooltip(description) button:setIcon(resolvepath(icon, 3)) @@ -57,36 +62,36 @@ function TopMenu.terminate() TopMenu = nil end -function TopMenu.addLeftButton(id, description, icon, callback) - return addButton(id, description, icon, callback, leftButtonsPanel, false) +function TopMenu.addLeftButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, leftButtonsPanel, false, front) end -function TopMenu.addLeftToggleButton(id, description, icon, callback, right) - return addButton(id, description, icon, callback, leftButtonsPanel, true) +function TopMenu.addLeftToggleButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, leftButtonsPanel, true, front) end -function TopMenu.addRightButton(id, description, icon, callback) - return addButton(id, description, icon, callback, rightButtonsPanel, false) +function TopMenu.addRightButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, rightButtonsPanel, false, front) end -function TopMenu.addRightToggleButton(id, description, icon, callback, right) - return addButton(id, description, icon, callback, rightButtonsPanel, true) +function TopMenu.addRightToggleButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, rightButtonsPanel, true, front) end -function TopMenu.addLeftGameButton(id, description, icon, callback) - return addButton(id, description, icon, callback, leftGameButtonsPanel, false) +function TopMenu.addLeftGameButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, leftGameButtonsPanel, false, front) end -function TopMenu.addLeftGameToggleButton(id, description, icon, callback, right) - return addButton(id, description, icon, callback, leftGameButtonsPanel, true) +function TopMenu.addLeftGameToggleButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, leftGameButtonsPanel, true, front) end -function TopMenu.addRightGameButton(id, description, icon, callback) - return addButton(id, description, icon, callback, rightGameButtonsPanel, false) +function TopMenu.addRightGameButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, rightGameButtonsPanel, false, front) end -function TopMenu.addRightGameToggleButton(id, description, icon, callback, right) - return addButton(id, description, icon, callback, rightGameButtonsPanel, true) +function TopMenu.addRightGameToggleButton(id, description, icon, callback, front) + return addButton(id, description, icon, callback, rightGameButtonsPanel, true, front) end function TopMenu.hideGameButtons() diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index ccf5fa8b..860ee31f 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -49,8 +49,7 @@ function init() gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel') connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange }) - logoutButton = TopMenu.addRightButton('logoutButton', 'Logout', '/images/logout.png', tryLogout) - logoutButton:hide() + logoutButton = TopMenu.addLeftButton('logoutButton', 'Logout', '/images/logout.png', tryLogout, true) bindKeys() @@ -124,7 +123,6 @@ end function show() connect(g_app, { onClose = tryExit }) - logoutButton:show() Background.hide() gameRootPanel:show() gameRootPanel:focus() @@ -147,7 +145,6 @@ function hide() countWindow = nil end gameRootPanel:hide() - logoutButton:hide() Background.show() end @@ -186,6 +183,10 @@ function logout() end function tryLogout() + if not g_game.isOnline() then + exit() + end + if logoutWindow then return end