Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10282 was 9016, checked in by jo, 13 years ago

Merging presentation2011 branch to trunk. Please check for possible bugs.

  • Property svn:eol-style set to native
File size: 1.8 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 4x1 matrix, the left lower item is nil
10    P:setButton(1, 1, {
11            ["button"] = winMgr:getWindow("orxonox/InGameMenu_ReturnButton"),
12            ["callback"]  = P.button_return_clicked
13    })
14
15    P:setButton(2, 1, {
16            ["button"] = winMgr:getWindow("orxonox/InGameMenu_MainMenuButton"),
17            ["callback"]  = P.button_mainmenu_clicked
18    })
19
20    P:setButton(3, 1, {
21            ["button"] = winMgr:getWindow("orxonox/InGameMenu_SettingsButton"),
22            ["callback"]  = P.button_settings_clicked
23    })
24
25    P:setButton(4, 1, {
26            ["button"] = winMgr:getWindow("orxonox/InGameMenu_QuitButton"),
27            ["callback"]  = P.button_quit_clicked
28    })
29end
30
31function P.onShow()
32    if P:hasSelection() == false then
33        P:setSelection(1, 1)
34    end
35
36    orxonox.execute("setPause 1")
37end
38
39function P.onQuit()
40    orxonox.execute("setPause 0")
41end
42
43-- events for ingamemenu
44function P.button_quit_clicked(e)
45    openDecisionPopup( "Do you really want to quit the game?", InGameMenu.exitCallback )
46end
47
48function P.button_mainmenu_clicked(e)
49    openDecisionPopup( "Do you really want to return to the main menu?", InGameMenu.mainMenuCallback )
50end
51
52function P.button_settings_clicked(e)
53    showMenuSheet("SettingsMenu", true)
54end
55
56function P.button_return_clicked(e)
57    hideMenuSheet("InGameMenu")
58end
59
60function P.mainMenuCallback(doExit)
61    if doExit then
62        orxonox.execute("startMainMenu")
63        hideMenuSheet("InGameMenu")
64    else
65        P.onShow()
66    end
67end
68
69function P.exitCallback(doExit)
70    if doExit then
71        hideMenuSheet("InGameMenu")
72        orxonox.execute("exit")
73    else
74        P.onShow()
75    end
76end
77
78return P
79
Note: See TracBrowser for help on using the repository browser.