Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5559


Ignore:
Timestamp:
May 25, 2009, 10:08:48 PM (15 years ago)
Author:
bknecht
Message:

some fixes for pickupinventory and whole gui implementation

Location:
data/media/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • data/media/gui/layouts/PickupInventory.layout

    r5551 r5559  
    2727            </Window>
    2828        </Window>
    29        
    30         <Event Name="WindowUpdate" Function="frmUpdate" />
     29
     30        <Event Name="WindowUpdate" Function="PickupInventory.update" />
    3131    </Window>
    3232</GUILayout>
  • data/media/gui/scripts/PickupInventory.lua

    r5529 r5559  
    1 layoutPath = "PickupInventory.layout"
     1gui = require("gui")
     2local P = gui:new() --inherit everything from the gui package
    23
    3 -- variables
    4 local winMgr = CEGUI.WindowManager:getSingleton()
     4PickupInventory = P
    55
    6 local lastEquipmentCount_ = 0
    7 local lastUsableCount_ = 0
    8 local currentUsableID_ = 0
     6P.filename = "PickupInventory"
     7P.layoutString = "PickupInventory.layout"
     8
     9P.lastEquipmentCount_ = 0
     10P.lastUsableCount_ = 0
     11P.currentUsableID_ = 0
    912
    1013-- events
    11 function frmUpdate(e)
     14function P:frmUpdate(e)
    1215    local equipCount = orxonox.PickupInventory:getEquipmentCount()
    1316    local usableCount = orxonox.PickupInventory:getUsableCount()
    1417   
    15     if equipCount ~= lastEquipmentCount_ or usableCount ~= lastUsableCount_ then
    16         updateTabs()
     18    if equipCount ~= self.lastEquipmentCount_ or usableCount ~= self.lastUsableCount_ then
     19        self:updateTabs()
    1720    end
    1821end
    1922
    20 function itemClicked(e)
     23function P.update(e)
     24    loadedGUIs["PickupInventory"]:frmUpdate(e)
     25end
     26
     27function P.itemClicked(e)
     28    loadedGUIs["PickupInventory"]:mItemClicked(e)
     29end
     30
     31function P:mItemClicked(e)
    2132    local w = CEGUI.toWindowEventArgs(e).window
    2233    local name = w:getName()
     
    2940   
    3041    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")
     42        if self.currentUsableID_ >= 0 then
     43            winMgr:getWindow("orxonox/Inventory/Title/use/" .. self.currentUsableID_):setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
    3344        end
    3445        orxonox.PickupInventory:selectUsable(tonumber(i))
    35         currentUsableID_ = tonumber(i)
     46        self.currentUsableID_ = tonumber(i)
    3647        winMgr:getWindow("orxonox/Inventory/Title/use/" .. i):setProperty("TextColours", "tl:FFFF4444 tr:FFFF4444 bl:FFFF4444 br:FFFF4444")
    3748    end
     
    3950
    4051-- methods
    41 function updateTabs()
     52function P:updateTabs()
    4253    local eqWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabEquipment")
    4354    local usWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabUsable")
     
    4556    orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin)
    4657   
    47     currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
    48     lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
    49     lastUsableCount_ = orxonox.PickupInventory:getUsableCount()
     58    self.currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
     59    self.lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
     60    self.lastUsableCount_ = orxonox.PickupInventory:getUsableCount()
    5061end
     62
     63return PickupInventory
  • data/media/gui/scripts/gui.lua

    r5527 r5559  
    1515    setmetatable(newElement, self) -- connects new element with class
    1616    self.__index = self
    17     self:init()
    1817    return newElement
    1918end
     
    3635
    3736function P:load ()
    38     return self:new(winMgr:loadWindowLayout(self.layoutString), self.filename)
     37    self.window = winMgr:loadWindowLayout(self.layoutString)
     38    self:init()
     39    return self
    3940end
    4041
  • data/media/gui/scripts/mainmenu_2.lua

    r5532 r5559  
    1212    preselect = orxonox.Game:getInstance():getLevel()
    1313    orxonox.GUIManager:getInstance():getLevelList() --levellist variable ist set now
     14    table.sort(levellist)
    1415    for k,v in pairs(levellist) do
    1516        item = CEGUI.createListboxTextItem(v)       
Note: See TracChangeset for help on using the changeset viewer.