[5506] | 1 | layoutPath = "PickupInventory.layout" |
---|
| 2 | |
---|
[5526] | 3 | -- variables |
---|
| 4 | local winMgr = CEGUI.WindowManager:getSingleton() |
---|
[5529] | 5 | |
---|
[5526] | 6 | local lastEquipmentCount_ = 0 |
---|
| 7 | local lastUsableCount_ = 0 |
---|
[5529] | 8 | local currentUsableID_ = 0 |
---|
[5526] | 9 | |
---|
[5506] | 10 | -- events |
---|
| 11 | function frmUpdate(e) |
---|
[5526] | 12 | local equipCount = orxonox.PickupInventory:getEquipmentCount() |
---|
| 13 | local usableCount = orxonox.PickupInventory:getUsableCount() |
---|
[5506] | 14 | |
---|
[5526] | 15 | if equipCount ~= lastEquipmentCount_ or usableCount ~= lastUsableCount_ then |
---|
| 16 | updateTabs() |
---|
| 17 | end |
---|
[5506] | 18 | end |
---|
| 19 | |
---|
[5526] | 20 | function itemClicked(e) |
---|
| 21 | local w = CEGUI.toWindowEventArgs(e).window |
---|
| 22 | local name = w:getName() |
---|
| 23 | local t = name:sub(25, 27) |
---|
| 24 | local i = name:sub(29) |
---|
| 25 | |
---|
| 26 | if t == "equ" then |
---|
| 27 | |
---|
| 28 | end |
---|
| 29 | |
---|
| 30 | if t == "use" then |
---|
| 31 | if currentUsableID_ >= 0 then |
---|
| 32 | winMgr:getWindow("orxonox/Inventory/Title/use/" .. currentUsableID_):setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF") |
---|
| 33 | end |
---|
| 34 | orxonox.PickupInventory:selectUsable(tonumber(i)) |
---|
| 35 | currentUsableID_ = tonumber(i) |
---|
| 36 | winMgr:getWindow("orxonox/Inventory/Title/use/" .. i):setProperty("TextColours", "tl:FFFF4444 tr:FFFF4444 bl:FFFF4444 br:FFFF4444") |
---|
| 37 | end |
---|
[5506] | 38 | end |
---|
[5526] | 39 | |
---|
| 40 | -- methods |
---|
| 41 | function updateTabs() |
---|
| 42 | local eqWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabEquipment") |
---|
| 43 | local usWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabUsable") |
---|
[5529] | 44 | orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin) |
---|
| 45 | orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin) |
---|
[5526] | 46 | |
---|
| 47 | currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex() |
---|
| 48 | lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount() |
---|
| 49 | lastUsableCount_ = orxonox.PickupInventory:getUsableCount() |
---|
| 50 | end |
---|