Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/menu/data/gui/scripts/MainMenu.lua @ 7649

Last change on this file since 7649 was 7608, checked in by dafrick, 14 years ago

Some adjustments.

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1-- MainMenu.lua
2
3local P = createMenuSheet("MainMenu")
4P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" }
5
6P.index = 0
7
8-- events for MainMenu
9function P.QuickGameTestButton_clicked(e)
10    hideAllMenuSheets()
11    orxonox.execute("startGame")
12end
13
14function P.onShow()
15
16end
17
18function P.SingleplayerButton_clicked(e)
19    showMenuSheet("SingleplayerMenu", true)
20end
21
22function P.MultiplayerButton_clicked(e)
23    showMenuSheet("MultiplayerMenu", true)
24end
25
26function P.SettingsButton_clicked(e)
27    showMenuSheet("SettingsMenu", true)
28end
29
30function P.CreditsButton_clicked(e)
31    showMenuSheet("CreditsMenu", true)
32end
33
34function P.ExitButton_clicked(e)
35    orxonox.execute("exit")
36end
37
38function P.onKeyPressed()
39    --local we = tolua.cast(e, "CEGUI::KeyEventArgs")
40    cout(0, code)
41    if code == "15" then
42        P.index = P.index + 1
43        local window = winMgr:getWindow("orxonox/MainMenuBackground")
44        if P.index == window:getChildCount() then
45            P.index = 1
46        end
47        local child = window:getChildAtIdx(P.index-1)
48        child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-7) .. "Highlight")
49        child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-7) .. "Highlight")
50        child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-7) .. "Highlight")
51    elseif code == "28" and P.index ~= 0 then
52        if P.index == 1 then
53            P.QuickGameTestButton_clicked()
54        elseif P.index == 2 then
55            P.SingleplayerButton_clicked()
56        elseif P.index == 3 then
57            P.MultiplayerButton_clicked()
58        elseif P.index == 4 then
59            P.SettingsButton_clicked()
60        elseif P.index == 5 then
61            P.CreditsButton_clicked()
62        elseif P.index == 6 then
63            P.ExitButton_clicked()
64        end
65    end
66end
67
68return P
Note: See TracBrowser for help on using the repository browser.