make menu work

This commit is contained in:
Eduardo Bart
2012-01-02 20:09:49 -02:00
parent 43c16a1643
commit 90600bbd69
10 changed files with 128 additions and 47 deletions

View File

@@ -17,9 +17,6 @@ local InventorySlotAmmo = 10
-- public functions
function Inventory.create()
window = UI.display('inventory.otui', { parent = Game.gameRightPanel })
local itemWidget = window:getChildById('feet')
window:setHeight(itemWidget:getPosition().y + itemWidget:getHeight() - window:getPosition().y)
end
function Inventory.destroy()
@@ -66,6 +63,13 @@ function Inventory.onSoulChange(soul)
widget:setText("Soul:\n" .. soul)
end
function Inventory.onInventoryItemMousePress(itemWidget, mousePos, mouseButton)
local menu = UIPopupMenu.create()
menu:addOption('Look', function() print('look') end)
menu:addOption('Use', function() print('use') end)
menu:display(mousePos)
end
connect(Game, { onLogin = Inventory.create,
onLogout = Inventory.destroy,
onInventoryChange = Inventory.onInventoryChange,