[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 | |
---|
| 13 | local quit = winMgr:createWindow("TaharezLook/Button", "orxonox/QuitButton") |
---|
| 14 | quit:setText("Quit") |
---|
| 15 | quit:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
[5236] | 16 | quit:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.7, 0))) |
---|
[5162] | 17 | quit:subscribeEvent("Clicked","button_quit_clicked") |
---|
| 18 | |
---|
[5165] | 19 | local standalone = winMgr:createWindow("TaharezLook/Button", "orxonox/StandaloneButton") |
---|
| 20 | standalone:setText("Standalone") |
---|
| 21 | standalone:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
| 22 | standalone:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.3, 0))) |
---|
| 23 | standalone:subscribeEvent("Clicked","button_standalone_clicked") |
---|
[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))) |
---|
| 28 | dedicated:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.4, 0))) |
---|
| 29 | dedicated:subscribeEvent("Clicked","button_dedicated_clicked") |
---|
| 30 | |
---|
[5165] | 31 | local server = winMgr:createWindow("TaharezLook/Button", "orxonox/ServerButton") |
---|
| 32 | server:setText("Server") |
---|
| 33 | server:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
[5236] | 34 | server:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.5, 0))) |
---|
[5165] | 35 | server:subscribeEvent("Clicked","button_server_clicked") |
---|
| 36 | |
---|
| 37 | local client = winMgr:createWindow("TaharezLook/Button", "orxonox/ClientButton") |
---|
| 38 | client:setText("Client") |
---|
| 39 | client:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
[5236] | 40 | client:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.6, 0))) |
---|
[5165] | 41 | client:subscribeEvent("Clicked","button_client_clicked") |
---|
| 42 | |
---|
[5162] | 43 | local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "sample_loading.jpg") |
---|
| 44 | local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background") |
---|
| 45 | background:setProperty("Image", "set: GUI/Background image:full_image") |
---|
| 46 | |
---|
| 47 | rootSheet:addChildWindow(quit) |
---|
[5165] | 48 | rootSheet:addChildWindow(standalone) |
---|
| 49 | rootSheet:addChildWindow(server) |
---|
[5236] | 50 | rootSheet:addChildWindow(dedicated) |
---|
[5165] | 51 | rootSheet:addChildWindow(client) |
---|
[5162] | 52 | background:addChildWindow(rootSheet) |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | function button_quit_clicked(e) |
---|
[5163] | 56 | hideGUI() |
---|
[5162] | 57 | orxonox.CommandExecutor:execute("exit") |
---|
| 58 | end |
---|
| 59 | |
---|
[5165] | 60 | function button_standalone_clicked(e) |
---|
[5164] | 61 | orxonox.CommandExecutor:execute("selectGameState standalone") |
---|
[5162] | 62 | hideGUI() |
---|
| 63 | end |
---|
| 64 | |
---|
[5165] | 65 | function button_server_clicked(e) |
---|
| 66 | orxonox.CommandExecutor:execute("selectGameState server") |
---|
| 67 | hideGUI() |
---|
| 68 | end |
---|
| 69 | |
---|
[5236] | 70 | function button_dedicated_clicked(e) |
---|
| 71 | orxonox.CommandExecutor:execute("selectGameState dedicated") |
---|
| 72 | hideGUI() |
---|
| 73 | end |
---|
| 74 | |
---|
[5165] | 75 | function button_client_clicked(e) |
---|
| 76 | orxonox.CommandExecutor:execute("selectGameState client") |
---|
| 77 | hideGUI() |
---|
| 78 | end |
---|
| 79 | |
---|
[5163] | 80 | showBackground = false |
---|
[5162] | 81 | |
---|
| 82 | function showMainMenu() |
---|
| 83 | if showBackground == true then |
---|
| 84 | system:setGUISheet(background) |
---|
| 85 | else |
---|
| 86 | system:setGUISheet(rootSheet) |
---|
| 87 | end |
---|
| 88 | return 0; |
---|
| 89 | end |
---|
| 90 | |
---|
| 91 | function hideGUI() |
---|
| 92 | system:setGUISheet(nil) |
---|
[5164] | 93 | orxonox.GUIManager:getInstance():hideGUI() |
---|
[5162] | 94 | end |
---|