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