layoutPath = "PickupInventory.layout" -- variables local winMgr = CEGUI.WindowManager:getSingleton() local lastEquipmentCount_ = 0 local lastUsableCount_ = 0 local currentUsableID_ = 0 -- events function frmUpdate(e) local equipCount = orxonox.PickupInventory:getEquipmentCount() local usableCount = orxonox.PickupInventory:getUsableCount() if equipCount ~= lastEquipmentCount_ or usableCount ~= lastUsableCount_ then updateTabs() end end function itemClicked(e) local w = CEGUI.toWindowEventArgs(e).window local name = w:getName() local t = name:sub(25, 27) local i = name:sub(29) if t == "equ" then end if t == "use" then if currentUsableID_ >= 0 then winMgr:getWindow("orxonox/Inventory/Title/use/" .. currentUsableID_):setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF") end orxonox.PickupInventory:selectUsable(tonumber(i)) currentUsableID_ = tonumber(i) winMgr:getWindow("orxonox/Inventory/Title/use/" .. i):setProperty("TextColours", "tl:FFFF4444 tr:FFFF4444 bl:FFFF4444 br:FFFF4444") end end -- methods function updateTabs() local eqWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabEquipment") local usWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabUsable") orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin) orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin) currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex() lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount() lastUsableCount_ = orxonox.PickupInventory:getUsableCount() end