Save miniwindows states

This commit is contained in:
Henrique Santiago
2012-06-21 16:31:22 -03:00
parent 96c363d997
commit a7c17cec2e
22 changed files with 317 additions and 60 deletions

View File

@@ -14,7 +14,6 @@ function Inventory.init()
Keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel())
inventoryWindow.onClose = Inventory.toggle
inventoryPanel = inventoryWindow:getChildById('contentsPanel')
inventoryButton = TopMenu.addGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', 'inventory.png', Inventory.toggle)
inventoryButton:setOn(true)
@@ -50,9 +49,17 @@ function Inventory.refresh()
end
function Inventory.toggle()
local visible = not inventoryWindow:isExplicitlyVisible()
inventoryWindow:setVisible(visible)
inventoryButton:setOn(visible)
if inventoryButton:isOn() then
inventoryWindow:close()
inventoryButton:setOn(false)
else
inventoryWindow:open()
inventoryButton:setOn(true)
end
end
function Inventory.onMiniWindowClose()
inventoryButton:setOn(false)
end
-- hooked events