Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Some changes on pickups

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