Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/media/gui/scripts/mainmenu_2.lua @ 5562

Last change on this file since 5562 was 5559, checked in by bknecht, 16 years ago

some fixes for pickupinventory and whole gui implementation

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