Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/data/gui/scripts/InGameMenu.lua @ 12365

Last change on this file since 12365 was 11806, checked in by landauf, 7 years ago

migrated all ingame menus to cegui 0.8

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1-- InGameMenu.lua
2
3local P = createMenuSheet("InGameMenu")
4P.loadAlong = { "DecisionPopup" }
5
6function P.onLoad()
7    P.multiplayerMode = "startClient"
8
9    --button are arranged in a 5x1 matrix, the left lower item is nil
10    P:setButton(1, 1, {
11            ["button"] = P.window:getChild("InGameMenu_ReturnButton"),
12            ["callback"]  = P.button_return_clicked
13    })
14
15    P:setButton(2, 1, {
16            ["button"] = P.window:getChild("InGameMenu_ReloadLevelButton"),
17            ["callback"]  = P.button_reloadLevel_clicked
18    })
19
20    P:setButton(3, 1, {
21            ["button"] = P.window:getChild("InGameMenu_MainMenuButton"),
22            ["callback"]  = P.button_mainmenu_clicked
23    })
24
25    P:setButton(4, 1, {
26            ["button"] = P.window:getChild("InGameMenu_SettingsButton"),
27            ["callback"]  = P.button_settings_clicked
28    })
29
30    P:setButton(5, 1, {
31            ["button"] = P.window:getChild("InGameMenu_QuitButton"),
32            ["callback"]  = P.button_quit_clicked
33    })
34end
35
36function P.onShow()
37    if P:hasSelection() == false then
38        P:setSelection(1, 1)
39    end
40
41    orxonox.execute("setPause 1")
42end
43
44function P.onQuit()
45    orxonox.execute("setPause 0")
46end
47
48-- events for ingamemenu
49function P.button_quit_clicked(e)
50    openDecisionPopup( "Do you really want to quit the game?", InGameMenu.exitCallback )
51end
52
53function P.button_mainmenu_clicked(e)
54    openDecisionPopup( "Do you really want to return to the main menu?", InGameMenu.mainMenuCallback )
55end
56
57function P.button_settings_clicked(e)
58    showMenuSheet("SettingsMenu", true)
59end
60
61function P.button_reloadLevel_clicked(e)
62    hideMenuSheet("InGameMenu")
63    orxonox.execute("reloadLevel")
64end
65
66function P.button_return_clicked(e)
67    hideMenuSheet("InGameMenu")
68end
69
70function P.mainMenuCallback(doExit)
71    if doExit then
72        orxonox.execute("startMainMenu")
73        hideMenuSheet("InGameMenu")
74    else
75        P.onShow()
76    end
77end
78
79function P.exitCallback(doExit)
80    if doExit then
81        hideMenuSheet("InGameMenu")
82        orxonox.execute("exit")
83    else
84        P.onShow()
85    end
86end
87
88return P
89
Note: See TracBrowser for help on using the repository browser.