mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 23:26:51 +01:00
Interface edits, additions, and fixes:
* Added a new module for exiting the client (client_exit). * Added tab spacing to the UITabBar class. * Added tab popup menus for things like channel tabs. * Impelemented channel tab popup menus (still need to be finished). * Fixed UITabBar tab draging (will now change after dragged half way over the next tab, not 2 pixels). * Fixes to the client_options module. * Edited some UI settings. * Changed game_cooldown and game_spelllist menu button icons. * Fixed some typos.
This commit is contained in:
59
modules/client_exit/exit.lua
Normal file
59
modules/client_exit/exit.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
Exit = {}
|
||||
|
||||
local exitWindow
|
||||
local exitButton
|
||||
|
||||
function Exit.init()
|
||||
exitButton = TopMenu.addRightButton('exitButton', tr('Exit Client'), 'exit.png', Exit.tryExit)
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user