[5491] | 1 | -- mainmenu_2.lua |
---|
| 2 | gui = require("gui") |
---|
| 3 | local P = gui:new() --inherit everything from the gui package |
---|
| 4 | |
---|
| 5 | mainmenu_2 = P |
---|
| 6 | |
---|
| 7 | P.filename = "mainmenu_2" |
---|
| 8 | P.layoutString = "MainMenu_2.layout" |
---|
| 9 | |
---|
[5523] | 10 | function P:init() |
---|
[5527] | 11 | listbox = winMgr:getWindow("orxonox/LevelListbox") |
---|
| 12 | orxonox.GUIManager:getInstance():getLevelList() |
---|
| 13 | for k,v in pairs(levellist) do |
---|
| 14 | item = CEGUI.createListboxTextItem(v) |
---|
| 15 | item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush") |
---|
| 16 | CEGUI.toListbox(listbox):addItem(item) |
---|
| 17 | end |
---|
[5491] | 18 | end |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | -- events for mainmenu |
---|
| 22 | function P.button_quit_clicked(e) |
---|
[5527] | 23 | hideGUI() |
---|
| 24 | orxonox.CommandExecutor:execute("exit") |
---|
[5491] | 25 | end |
---|
| 26 | |
---|
| 27 | function P.button_standalone_clicked(e) |
---|
[5527] | 28 | choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() |
---|
| 29 | if choice then |
---|
| 30 | orxonox.CommandExecutor:execute("setLevel " .. choice:getText() .. ".oxw") |
---|
| 31 | orxonox.CommandExecutor:execute("startGame") |
---|
| 32 | toggleGUI() |
---|
| 33 | end |
---|
[5491] | 34 | end |
---|
| 35 | |
---|
| 36 | function P.button_server_clicked(e) |
---|
| 37 | orxonox.CommandExecutor:execute("echo Not yet supported!") |
---|
| 38 | hideGUI() |
---|
| 39 | end |
---|
| 40 | |
---|
| 41 | function P.button_dedicated_clicked(e) |
---|
| 42 | orxonox.CommandExecutor:execute("echo Not yet supported!") |
---|
| 43 | hideGUI() |
---|
| 44 | end |
---|
| 45 | |
---|
| 46 | function P.button_client_clicked(e) |
---|
| 47 | orxonox.CommandExecutor:execute("echo Not yet supported!") |
---|
| 48 | hideGUI() |
---|
| 49 | end |
---|
| 50 | |
---|
[5527] | 51 | function P.listbox_level_selectionchanged(e) |
---|
| 52 | if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then |
---|
| 53 | winMgr:getWindow("orxonox/StandaloneButton"):enable() |
---|
| 54 | else |
---|
| 55 | winMgr:getWindow("orxonox/StandaloneButton"):disable() |
---|
| 56 | end |
---|
| 57 | end |
---|
| 58 | |
---|
[5491] | 59 | return mainmenu_2 |
---|
| 60 | |
---|