Rev | Line | |
---|
[8434] | 1 | -- DockingDialog.lua |
---|
| 2 | |
---|
| 3 | local P = createMenuSheet("DockingDialog") |
---|
| 4 | |
---|
| 5 | P.docks = {} |
---|
| 6 | |
---|
| 7 | function P.onLoad() |
---|
| 8 | |
---|
| 9 | end |
---|
| 10 | |
---|
| 11 | function P.onShow() |
---|
| 12 | P.update() |
---|
| 13 | orxonox.CommandExecutor:execute("pause") |
---|
| 14 | end |
---|
| 15 | |
---|
| 16 | function P.onHide() |
---|
| 17 | orxonox.CommandExecutor:execute("pause") |
---|
| 18 | end |
---|
| 19 | |
---|
| 20 | function 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 |
---|
| 36 | end |
---|
| 37 | |
---|
| 38 | function 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) |
---|
| 51 | end |
---|
| 52 | |
---|
| 53 | function P.cancelButton_clicked(e) |
---|
| 54 | --P.hideMe() |
---|
| 55 | hideMenuSheet(P.name) |
---|
| 56 | end |
---|
| 57 | |
---|
| 58 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.