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))) |
---|
16 | quit:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.7, 0))) |
---|
17 | quit:subscribeEvent("Clicked","button_quit_clicked") |
---|
18 | |
---|
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") |
---|
24 | |
---|
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 | |
---|
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))) |
---|
34 | server:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.5, 0))) |
---|
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))) |
---|
40 | client:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.6, 0))) |
---|
41 | client:subscribeEvent("Clicked","button_client_clicked") |
---|
42 | |
---|
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) |
---|
48 | rootSheet:addChildWindow(standalone) |
---|
49 | rootSheet:addChildWindow(server) |
---|
50 | rootSheet:addChildWindow(dedicated) |
---|
51 | rootSheet:addChildWindow(client) |
---|
52 | background:addChildWindow(rootSheet) |
---|
53 | |
---|
54 | |
---|
55 | function button_quit_clicked(e) |
---|
56 | hideGUI() |
---|
57 | orxonox.CommandExecutor:execute("exit") |
---|
58 | end |
---|
59 | |
---|
60 | function button_standalone_clicked(e) |
---|
61 | orxonox.CommandExecutor:execute("selectGameState standalone") |
---|
62 | hideGUI() |
---|
63 | end |
---|
64 | |
---|
65 | function button_server_clicked(e) |
---|
66 | orxonox.CommandExecutor:execute("selectGameState server") |
---|
67 | hideGUI() |
---|
68 | end |
---|
69 | |
---|
70 | function button_dedicated_clicked(e) |
---|
71 | orxonox.CommandExecutor:execute("selectGameState dedicated") |
---|
72 | hideGUI() |
---|
73 | end |
---|
74 | |
---|
75 | function button_client_clicked(e) |
---|
76 | orxonox.CommandExecutor:execute("selectGameState client") |
---|
77 | hideGUI() |
---|
78 | end |
---|
79 | |
---|
80 | showBackground = false |
---|
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) |
---|
93 | orxonox.GUIManager:getInstance():hideGUI() |
---|
94 | end |
---|