parent
1500c1d2f2
commit
ddaff8a46a
@ -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
|
|
@ -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()
|
|
Before Width: | Height: | Size: 733 B |
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 381 B |
Loading…
Reference in new issue