restore inventory and healthbar

* make inventory/healthbar work again allowing reload
* changes in top menu toggle buttons
* all modules are now reloadable by default
* fix warning when using fade in
* remove some unused files
This commit is contained in:
Eduardo Bart
2012-03-23 10:48:05 -03:00
parent b301aa1a2b
commit 239f58296e
41 changed files with 134 additions and 407 deletions

View File

@@ -5,15 +5,31 @@ local inventoryWindow
local inventoryButton
-- public functions
function Inventory.create()
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel())
inventoryButton = TopMenu.addGameButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
inventoryButton:setOn(true)
function Inventory.init()
connect(g_game, { onGameEnd = Inventory.clear,
onInventoryChange = Inventory.onInventoryChange,
onFreeCapacityChange = Inventory.onFreeCapacityChange,
onSoulChange = Inventory.onSoulChange })
Keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel())
inventoryButton = TopMenu.addGameToggleButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
inventoryButton:setOn(true)
if g_game.isOnline() then
Inventory.reload()
end
end
function Inventory.destroy()
function Inventory.terminate()
connect(g_game, { onGameEnd = Inventory.clear,
onInventoryChange = Inventory.onInventoryChange,
onFreeCapacityChange = Inventory.onFreeCapacityChange,
onSoulChange = Inventory.onSoulChange })
Keyboard.unbindKeyDown('Ctrl+I')
inventoryWindow:destroy()
inventoryWindow = nil
inventoryButton:destroy()
@@ -26,6 +42,12 @@ function Inventory.toggle()
inventoryButton:setOn(visible)
end
function Inventory.clear()
end
function Inventory.reload()
end
-- hooked events
function Inventory.onInventoryChange(slot, item)
local itemWidget = inventoryWindow:getChildById('slot' .. slot)
@@ -41,10 +63,3 @@ function Inventory.onSoulChange(soul)
local widget = inventoryWindow:getChildById('soul')
widget:setText("Soul:\n" .. soul)
end
connect(g_game, { onGameStart = Inventory.create,
onGameEnd = Inventory.destroy,
onInventoryChange = Inventory.onInventoryChange,
onFreeCapacityChange = Inventory.onFreeCapacityChange,
onSoulChange = Inventory.onSoulChange })