creature square init, inventory improvements

This commit is contained in:
Henrique
2011-11-13 20:23:21 -02:00
parent 5f34648c0e
commit fd80589c7b
7 changed files with 91 additions and 25 deletions

View File

@@ -29,7 +29,7 @@ function Inventory.destroy()
end
-- hooked events
function Game.onInventoryChange(slot, item)
function Inventory.onInventoryChange(slot, item)
local slotId
if slot == InventorySlotHead then
slotId = 'head'
@@ -57,5 +57,18 @@ function Game.onInventoryChange(slot, item)
itemWidget:setItem(item)
end
function Inventory.onFreeCapacityChange(freeCapacity)
local widget = window:getChildById('capacity')
widget:setText("Cap:\n" .. freeCapacity)
end
function Inventory.onSoulChange(soul)
local widget = window:getChildById('soul')
widget:setText("Soul:\n" .. soul)
end
connect(Game, { onLogin = Inventory.create,
onLogout = Inventory.destroy })
onLogout = Inventory.destroy,
onInventoryChange = Inventory.onInventoryChange,
onFreeCapacityChange = Inventory.onFreeCapacityChange,
onSoulChange = Inventory.onSoulChange })

View File

@@ -15,57 +15,83 @@ UIWindow
id: armor
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin.top: 10
margin.top: 5
Item
id: legs
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin.top: 10
margin.top: 5
Item
id: feet
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin.top: 10
margin.top: 5
Item
id: necklace
anchors.top: parent.top
anchors.right: head.left
margin.top: 15
margin.right: 10
margin.top: 10
margin.right: 5
Item
id: left
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin.top: 10
margin.top: 5
Item
id: ring
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin.top: 10
margin.top: 5
Item
id: backpack
anchors.top: parent.top
anchors.left: head.right
margin.top: 15
margin.left: 10
margin.top: 10
margin.left: 5
Item
id: right
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin.top: 10
margin.top: 5
Item
id: ammo
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin.top: 10
margin.top: 5
Label
id: soul
anchors.top: ring.bottom
anchors.bottom: feet.bottom
anchors.left: ring.left
anchors.right: ring.right
margin.top: 5
align: center
border-image:
source: /core_styles/images/panel_flat.png
border: 4
Label
id: capacity
anchors.top: ammo.bottom
anchors.bottom: feet.bottom
anchors.left: ammo.left
anchors.right: ammo.right
margin.top: 5
align: center
border-image:
source: /core_styles/images/panel_flat.png
border: 4