[5162] | 1 | local schemeMgr = CEGUI.SchemeManager:getSingleton() |
---|
| 2 | local winMgr = CEGUI.WindowManager:getSingleton() |
---|
| 3 | local logger = CEGUI.Logger:getSingleton() |
---|
| 4 | local system = CEGUI.System:getSingleton() |
---|
| 5 | |
---|
| 6 | schemeMgr:loadScheme("TaharezLookSkin.scheme") |
---|
| 7 | system:setDefaultMouseCursor("TaharezLook", "MouseArrow") |
---|
| 8 | system:setDefaultFont("BlueHighway-12") |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | local rootSheet = winMgr:createWindow("DefaultGUISheet", "orxonox/Sheet") |
---|
| 12 | |
---|
[5387] | 13 | local leftOffset = 0.11 |
---|
| 14 | local topOffset = 0.3 |
---|
| 15 | local distance = 0.076 |
---|
| 16 | local index = 0 |
---|
[5162] | 17 | |
---|
[5165] | 18 | local standalone = winMgr:createWindow("TaharezLook/Button", "orxonox/StandaloneButton") |
---|
| 19 | standalone:setText("Standalone") |
---|
| 20 | standalone:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
[5387] | 21 | standalone:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0))) |
---|
[5165] | 22 | standalone:subscribeEvent("Clicked","button_standalone_clicked") |
---|
[5387] | 23 | index = index + 1 |
---|
[5162] | 24 | |
---|
[5236] | 25 | local dedicated = winMgr:createWindow("TaharezLook/Button", "orxonox/DedicatedButton") |
---|
| 26 | dedicated:setText("Dedicated") |
---|
| 27 | dedicated:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
[5387] | 28 | dedicated:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0))) |
---|
[5236] | 29 | dedicated:subscribeEvent("Clicked","button_dedicated_clicked") |
---|
[5387] | 30 | index = index + 1 |
---|
[5236] | 31 | |
---|
[5165] | 32 | local server = winMgr:createWindow("TaharezLook/Button", "orxonox/ServerButton") |
---|
| 33 | server:setText("Server") |
---|
| 34 | server:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
[5387] | 35 | server:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0))) |
---|
[5165] | 36 | server:subscribeEvent("Clicked","button_server_clicked") |
---|
[5387] | 37 | index = index + 1 |
---|
[5165] | 38 | |
---|
| 39 | local client = winMgr:createWindow("TaharezLook/Button", "orxonox/ClientButton") |
---|
| 40 | client:setText("Client") |
---|
| 41 | client:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
[5387] | 42 | client:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0))) |
---|
[5165] | 43 | client:subscribeEvent("Clicked","button_client_clicked") |
---|
[5387] | 44 | index = index + 1 |
---|
[5165] | 45 | |
---|
[5387] | 46 | local quit = winMgr:createWindow("TaharezLook/Button", "orxonox/QuitButton") |
---|
| 47 | quit:setText("Quit") |
---|
| 48 | quit:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
| 49 | quit:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0))) |
---|
| 50 | quit:subscribeEvent("Clicked","button_quit_clicked") |
---|
| 51 | index = index + 1 |
---|
| 52 | |
---|
| 53 | local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "main_menu_1.jpg") |
---|
[5162] | 54 | local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background") |
---|
[5387] | 55 | background:setProperty("FrameEnabled", "set: true") |
---|
| 56 | background:setProperty("BackgroundEnabled", "set: false") |
---|
[5162] | 57 | background:setProperty("Image", "set: GUI/Background image:full_image") |
---|
| 58 | |
---|
| 59 | rootSheet:addChildWindow(quit) |
---|
[5165] | 60 | rootSheet:addChildWindow(standalone) |
---|
| 61 | rootSheet:addChildWindow(server) |
---|
[5236] | 62 | rootSheet:addChildWindow(dedicated) |
---|
[5165] | 63 | rootSheet:addChildWindow(client) |
---|
[5162] | 64 | background:addChildWindow(rootSheet) |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | function button_quit_clicked(e) |
---|
[5163] | 68 | hideGUI() |
---|
[5162] | 69 | orxonox.CommandExecutor:execute("exit") |
---|
| 70 | end |
---|
| 71 | |
---|
[5165] | 72 | function button_standalone_clicked(e) |
---|
[5164] | 73 | orxonox.CommandExecutor:execute("selectGameState standalone") |
---|
[5162] | 74 | hideGUI() |
---|
| 75 | end |
---|
| 76 | |
---|
[5165] | 77 | function button_server_clicked(e) |
---|
| 78 | orxonox.CommandExecutor:execute("selectGameState server") |
---|
| 79 | hideGUI() |
---|
| 80 | end |
---|
| 81 | |
---|
[5236] | 82 | function button_dedicated_clicked(e) |
---|
| 83 | orxonox.CommandExecutor:execute("selectGameState dedicated") |
---|
| 84 | hideGUI() |
---|
| 85 | end |
---|
| 86 | |
---|
[5165] | 87 | function button_client_clicked(e) |
---|
| 88 | orxonox.CommandExecutor:execute("selectGameState client") |
---|
| 89 | hideGUI() |
---|
| 90 | end |
---|
| 91 | |
---|
[5163] | 92 | showBackground = false |
---|
[5162] | 93 | |
---|
| 94 | function showMainMenu() |
---|
| 95 | if showBackground == true then |
---|
| 96 | system:setGUISheet(background) |
---|
| 97 | else |
---|
| 98 | system:setGUISheet(rootSheet) |
---|
| 99 | end |
---|
| 100 | return 0; |
---|
| 101 | end |
---|
| 102 | |
---|
| 103 | function hideGUI() |
---|
| 104 | system:setGUISheet(nil) |
---|
[5164] | 105 | orxonox.GUIManager:getInstance():hideGUI() |
---|
[5162] | 106 | end |
---|