fix use with, improve move, change icons, improve topbar

This commit is contained in:
Eduardo Bart
2012-01-24 16:39:16 -02:00
parent fb386b3845
commit 24aab00431
46 changed files with 185 additions and 108 deletions

View File

@@ -1,31 +1,42 @@
Inventory = {}
-- private variables
local window = nil
local inventoryWindow
local inventoryButton
-- public functions
function Inventory.create()
window = displayUI('inventory.otui', { parent = Game.gameRightPanel })
inventoryWindow = displayUI('inventory.otui', { parent = Game.gameRightPanel })
inventoryButton = TopMenu.addGameButton('inventoryButton', 'Skills (Ctrl+I)', 'inventory.png', Inventory.toggle)
inventoryButton:setOn(true)
end
function Inventory.destroy()
window:destroy()
window = nil
inventoryWindow:destroy()
inventoryWindow = nil
inventoryButton:destroy()
inventoryButton = nil
end
function Inventory.toggle()
local visible = not inventoryWindow:isExplicitlyVisible()
inventoryWindow:setVisible(visible)
inventoryButton:setOn(visible)
end
-- hooked events
function Inventory.onInventoryChange(slot, item)
local itemWidget = window:getChildById('slot' .. slot)
local itemWidget = inventoryWindow:getChildById('slot' .. slot)
itemWidget:setItem(item)
end
function Inventory.onFreeCapacityChange(freeCapacity)
local widget = window:getChildById('capacity')
local widget = inventoryWindow:getChildById('capacity')
widget:setText("Cap:\n" .. freeCapacity)
end
function Inventory.onSoulChange(soul)
local widget = window:getChildById('soul')
local widget = inventoryWindow:getChildById('soul')
widget:setText("Soul:\n" .. soul)
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B