Changeset 6206 for code/branches/presentation2/data/gui/scripts
- Timestamp:
- Dec 2, 2009, 5:25:42 PM (15 years ago)
- Location:
- code/branches/presentation2/data/gui/scripts
- Files:
-
- 11 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/gui/scripts/MainMenu.lua
r6150 r6206 12 12 P.layoutString = "MainMenu.layout" 13 13 14 function P:init() 15 listbox = winMgr:getWindow("orxonox/LevelListbox") 16 preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 17 orxonox.LevelManager:getInstance():compileAvailableLevelList() 18 local levelList = {} 19 local index = 0 20 local level = "" 21 while true do 22 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) 23 if level == "" then 24 break 25 end 26 table.insert(levelList, level) 27 index = index + 1 28 end 29 table.sort(levelList) 30 for k,v in pairs(levelList) do 31 item = CEGUI.createListboxTextItem(v) 32 item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush") 33 CEGUI.toListbox(listbox):addItem(item) 34 if v .. ".oxw" == preselect then 35 listbox:setItemSelectState(item, true) 36 end 37 end 14 -- events for MainMenu 15 function P.QuickGameTestButton_clicked(e) 16 orxonox.CommandExecutor:execute("startGame") 38 17 end 39 18 40 41 -- events for mainmenu 42 function P.button_quit_clicked(e) 43 hideGUI() 44 orxonox.CommandExecutor:execute("exit") 19 function P.SingleplayerButton_clicked(e) 20 showGUI("SingleplayerMenu", true) 45 21 end 46 22 47 function P.button_standalone_clicked(e) 48 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 49 if choice then 50 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 51 orxonox.CommandExecutor:execute("startGame") 52 hideGUI(P.filename) 53 end 23 function P.MultiplayerButton_clicked(e) 24 showGUI("MultiplayerMenu", true) 54 25 end 55 26 56 function P.button_server_clicked(e) 57 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 58 if choice then 59 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 60 orxonox.CommandExecutor:execute("startServer") 61 hideGUI(P.filename) 62 end 27 function P.SettingsButton_clicked(e) 28 showGUI("SettingsMenu", true) 63 29 end 64 30 65 function P.button_dedicated_clicked(e) 66 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 67 if choice then 68 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 69 orxonox.CommandExecutor:execute("startDedicated") 70 hideGUI(P.filename) 71 end 31 function P.CreditsButton_clicked(e) 32 showGUI("CreditsMenu", true) 72 33 end 73 34 74 function P.button_client_clicked(e) 75 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 76 if choice then 77 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 78 orxonox.CommandExecutor:execute("startClient") 79 hideGUI(P.filename) 80 81 end 82 end 83 84 function P.listbox_level_selectionchanged(e) 85 if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then 86 winMgr:getWindow("orxonox/StandaloneButton"):enable() 87 else 88 winMgr:getWindow("orxonox/StandaloneButton"):disable() 89 end 35 function P.ExitButton_clicked(e) 36 orxonox.CommandExecutor:execute("exit") 90 37 end 91 38
Note: See TracChangeset
for help on using the changeset viewer.