Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/menuanimations/data/gui/scripts/InGameMenu.lua @ 6445

Last change on this file since 6445 was 6048, checked in by scheusso, 15 years ago

ESC handling in ingame menu: if theres already an opened GUI sheet then hide it, if not open the ingame menu
in mainmenu everything should remain the same

File size: 1014 bytes
Line 
1-- InGameMenu.lua
2
3BasicGUI = require("BasicGUI")
4local P = BasicGUI:new() --inherit everything from the gui package
5if _REQUIREDNAME == nil then
6    InGameMenu = P
7else
8    _G[_REQUIREDNAME] = P
9end
10
11P.filename = "InGameMenu"
12P.layoutString = "InGameMenu.layout"
13
14function P:init()
15end
16
17
18-- events for ingamemenu
19function P.button_quit_clicked(e)
20    openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback )
21end
22
23function P.button_mainmenu_clicked(e)
24    orxonox.Game:getInstance():popState()
25    orxonox.Game:getInstance():popState()
26    orxonox.Game:getInstance():requestState("mainmenu")
27    orxonox.CommandExecutor:execute("showGUI MainMenu")
28    orxonox.CommandExecutor:execute("hideGUI InGameMenu")
29end
30
31function P.button_return_clicked(e)
32    orxonox.CommandExecutor:execute("hideGUI InGameMenu")
33end
34
35function P.callback(doExit)
36    if doExit then
37        orxonox.CommandExecutor:execute("hideGUI InGameMenu")
38        orxonox.CommandExecutor:execute("exit")
39    end
40end
41
42return P
43
Note: See TracBrowser for help on using the repository browser.