Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/media/gui/scripts/PickupInventory.lua @ 5533

Last change on this file since 5533 was 5529, checked in by danielh, 16 years ago

Some changes on pickups

File size: 1.7 KB
Line 
1layoutPath = "PickupInventory.layout"
2
3-- variables
4local winMgr = CEGUI.WindowManager:getSingleton()
5
6local lastEquipmentCount_ = 0
7local lastUsableCount_ = 0
8local currentUsableID_ = 0
9
10-- events
11function 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
18end
19
20function 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
38end
39
40-- methods
41function 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()
50end
Note: See TracBrowser for help on using the repository browser.