-- mainmenu_2.lua gui = require("gui") local P = gui:new() --inherit everything from the gui package mainmenu_2 = P P.filename = "mainmenu_2" P.layoutString = "MainMenu_2.layout" function P:init() listbox = winMgr:getWindow("orxonox/LevelListbox") orxonox.GUIManager:getInstance():getLevelList() for k,v in pairs(levellist) do item = CEGUI.createListboxTextItem(v) item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush") CEGUI.toListbox(listbox):addItem(item) end end -- events for mainmenu function P.button_quit_clicked(e) hideGUI() orxonox.CommandExecutor:execute("exit") end function P.button_standalone_clicked(e) choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() if choice then orxonox.CommandExecutor:execute("setLevel " .. choice:getText() .. ".oxw") orxonox.CommandExecutor:execute("startGame") toggleGUI() end end function P.button_server_clicked(e) orxonox.CommandExecutor:execute("echo Not yet supported!") hideGUI() end function P.button_dedicated_clicked(e) orxonox.CommandExecutor:execute("echo Not yet supported!") hideGUI() end function P.button_client_clicked(e) orxonox.CommandExecutor:execute("echo Not yet supported!") hideGUI() end function P.listbox_level_selectionchanged(e) if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then winMgr:getWindow("orxonox/StandaloneButton"):enable() else winMgr:getWindow("orxonox/StandaloneButton"):disable() end end return mainmenu_2