1 | layoutPath = "PickupInventory.layout" |
---|
2 | |
---|
3 | -- variables |
---|
4 | local winMgr = CEGUI.WindowManager:getSingleton() |
---|
5 | |
---|
6 | local lastEquipmentCount_ = 0 |
---|
7 | local lastUsableCount_ = 0 |
---|
8 | local currentUsableID_ = 0 |
---|
9 | |
---|
10 | -- events |
---|
11 | function frmUpdate(e) |
---|
12 | local equipCount = orxonox.PickupInventory:getEquipmentCount() |
---|
13 | local usableCount = orxonox.PickupInventory:getUsableCount() |
---|
14 | |
---|
15 | if equipCount ~= lastEquipmentCount_ or usableCount ~= lastUsableCount_ then |
---|
16 | updateTabs() |
---|
17 | end |
---|
18 | end |
---|
19 | |
---|
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 |
---|
38 | end |
---|
39 | |
---|
40 | -- methods |
---|
41 | function updateTabs() |
---|
42 | local eqWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabEquipment") |
---|
43 | local usWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabUsable") |
---|
44 | orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin) |
---|
45 | orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin) |
---|
46 | |
---|
47 | currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex() |
---|
48 | lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount() |
---|
49 | lastUsableCount_ = orxonox.PickupInventory:getUsableCount() |
---|
50 | end |
---|