1 | -- InGameMenu.lua |
---|
2 | |
---|
3 | local P = createMenuSheet("InGameMenu") |
---|
4 | P.loadAlong = { "DecisionPopup" } |
---|
5 | |
---|
6 | function 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 | }) |
---|
29 | end |
---|
30 | |
---|
31 | function P.onShow() |
---|
32 | if P:hasSelection() == false then |
---|
33 | P:setSelection(1, 1) |
---|
34 | end |
---|
35 | |
---|
36 | orxonox.execute("setPause 1") |
---|
37 | end |
---|
38 | |
---|
39 | function P.onQuit() |
---|
40 | orxonox.execute("setPause 0") |
---|
41 | end |
---|
42 | |
---|
43 | -- events for ingamemenu |
---|
44 | function P.button_quit_clicked(e) |
---|
45 | openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback ) |
---|
46 | end |
---|
47 | |
---|
48 | function P.button_mainmenu_clicked(e) |
---|
49 | orxonox.execute("startMainMenu") |
---|
50 | hideMenuSheet("InGameMenu") |
---|
51 | end |
---|
52 | |
---|
53 | function P.button_settings_clicked(e) |
---|
54 | showMenuSheet("SettingsMenu", true) |
---|
55 | end |
---|
56 | |
---|
57 | function P.button_return_clicked(e) |
---|
58 | hideMenuSheet("InGameMenu") |
---|
59 | end |
---|
60 | |
---|
61 | function P.callback(doExit) |
---|
62 | if doExit then |
---|
63 | hideMenuSheet("InGameMenu") |
---|
64 | orxonox.execute("exit") |
---|
65 | else |
---|
66 | P.onShow() |
---|
67 | end |
---|
68 | end |
---|
69 | |
---|
70 | return P |
---|
71 | |
---|