Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/cegui0.8_ogre1.9/data/gui/scripts/InGameMenu.lua @ 12168

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