replace require with dofile, rename Hotkeys to Keyboard

This commit is contained in:
Eduardo Bart
2012-02-06 02:39:52 -02:00
parent 64c9e4f1d5
commit f97104f12e
41 changed files with 284 additions and 126 deletions

View File

@@ -23,11 +23,11 @@ function TopMenu.init()
gameButtonsPanel = topMenu:getChildById('gameButtonsPanel')
TopMenu.addRightButton('logoutButton', 'Logout (Ctrl+Q)', '/core_styles/icons/logout.png', onLogout)
Hotkeys.bindKeyDown('Ctrl+Q', onLogout)
Keyboard.bindKeyDown('Ctrl+Q', onLogout)
end
function TopMenu.terminate()
Hotkeys.unbindKeyDown('Ctrl+Q')
Keyboard.unbindKeyDown('Ctrl+Q')
leftButtonsPanel = nil
rightButtonsPanel = nil
gameButtonsPanel = nil
@@ -71,16 +71,6 @@ function TopMenu.addRightButton(id, description, icon, callback)
return TopMenu.addButton(id, description, resolvepath(icon, 2), callback, true)
end
function TopMenu.removeButton(param)
local button
if type(param) == 'string' then
button = TopMenu.getButton(param)
else
button = param
end
button:destroy()
end
function TopMenu.hideGameButtons()
gameButtonsPanel:hide()
end
@@ -93,10 +83,5 @@ function TopMenu.getButton(id)
return topMenu:recursiveGetChildById(id)
end
function TopMenu:getLogoutButton(id)
return TopMenu.getButton('logoutButton')
end
connect(Game, { onLogin = TopMenu.showGameButtons,
onLogout = TopMenu.hideGameButtons})
onLogout = TopMenu.hideGameButtons })

View File

@@ -5,7 +5,7 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'topmenu'
dofile 'topmenu'
TopMenu.init()
onUnload: |