Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8474 was 8434, checked in by sven, 14 years ago

Added simple GUI for docking..

File size: 1.3 KB
RevLine 
[8434]1-- DockingDialog.lua
2
3local P = createMenuSheet("DockingDialog")
4
5P.docks = {}
6
7function P.onLoad()
8   
9end
10
11function P.onShow()
12    P.update()
13    orxonox.CommandExecutor:execute("pause")
14end
15
16function P.onHide()
17    orxonox.CommandExecutor:execute("pause")
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        cout(0, index )--.. ": " .. P.docks[index])
45        if dock ~= nil then
46            cout(0, "LUA>Docking")
47            dock:dock()
48        end
49    end
50    hideMenuSheet(P.name)
51end
52
53function P.cancelButton_clicked(e)
54    --P.hideMe()
55    hideMenuSheet(P.name)
56end
57
58return P
Note: See TracBrowser for help on using the repository browser.