Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/dockingsystem2/data/gui/scripts/DockingDialog.lua @ 8493

Last change on this file since 8493 was 8493, checked in by sven, 13 years ago

Added docking animations, skeletton for DockingController..

File size: 1.2 KB
Line 
1-- DockingDialog.lua
2
3local P = createMenuSheet("DockingDialog")
4
5P.docks = {}
6
7function P.onLoad()
8   
9end
10
11function P.onShow()
12    orxonox.execute("setPause 1")
13    P.update()
14end
15
16function P.onHide()
17    orxonox.execute("setPause 0")
18end
19
20function P.update()
21    -- update dock list
22    P.docks = {}
23    local docks = orxonox.Dock:getNumberOfActiveDocks()
24    for i = 0, docks-1 do
25        table.insert(P.docks, orxonox.Dock:getActiveDockAtIndex(i))
26    end
27
28    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/DockingDocks"))
29    listbox:resetList()
30
31    for k in pairs(P.docks) do
32        local item = CEGUI.createListboxTextItem("Dock " .. k)
33        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
34        listbox:addItem(item)
35    end
36end
37
38function P.dockButton_clicked(e)
39    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/DockingDocks"))
40    local choice = listbox:getFirstSelectedItem()
41    if choice ~= nil then
42        local index = listbox:getItemIndex(choice)
43        local dock = P.docks[index+1]
44        if dock ~= nil then
45            dock:dock()
46        end
47    end
48    hideMenuSheet(P.name)
49end
50
51function P.cancelButton_clicked(e)
52    hideMenuSheet(P.name)
53end
54
55return P
Note: See TracBrowser for help on using the repository browser.