1 | -- MainMenu.lua |
---|
2 | |
---|
3 | local P = createMenuSheet("MainMenu") |
---|
4 | P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" } |
---|
5 | |
---|
6 | function P.onLoad() |
---|
7 | --buttons are arranged in a 6x1 Matrix (list) |
---|
8 | P:initButtons(6, 1) |
---|
9 | |
---|
10 | P:setButton(1, 1, { |
---|
11 | ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"), |
---|
12 | ["callback"] = P.QuickGameTestButton_clicked |
---|
13 | }) |
---|
14 | |
---|
15 | P:setButton(2, 1, { |
---|
16 | ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"), |
---|
17 | ["callback"] = P.SingleplayerButton_clicked |
---|
18 | }) |
---|
19 | |
---|
20 | P:setButton(3, 1, { |
---|
21 | ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"), |
---|
22 | ["callback"] = P.MultiplayerButton_clicked |
---|
23 | }) |
---|
24 | |
---|
25 | P:setButton(4, 1, { |
---|
26 | ["button"] = winMgr:getWindow("orxonox/SettingsButton"), |
---|
27 | ["callback"] = P.SettingsButton_clicked |
---|
28 | }) |
---|
29 | |
---|
30 | P:setButton(5, 1, { |
---|
31 | ["button"] = winMgr:getWindow("orxonox/CreditsButton"), |
---|
32 | ["callback"] = P.CreditsButton_clicked |
---|
33 | }) |
---|
34 | |
---|
35 | P:setButton(6, 1, { |
---|
36 | ["button"] = winMgr:getWindow("orxonox/ExitButton"), |
---|
37 | ["callback"] = P.ExitButton_clicked |
---|
38 | }) |
---|
39 | end |
---|
40 | |
---|
41 | -- events for MainMenu |
---|
42 | function P.QuickGameTestButton_clicked(e) |
---|
43 | hideAllMenuSheets() |
---|
44 | orxonox.execute("startGame") |
---|
45 | end |
---|
46 | |
---|
47 | function P.SingleplayerButton_clicked(e) |
---|
48 | showMenuSheet("SingleplayerMenu", true) |
---|
49 | end |
---|
50 | |
---|
51 | function P.MultiplayerButton_clicked(e) |
---|
52 | showMenuSheet("MultiplayerMenu", true) |
---|
53 | end |
---|
54 | |
---|
55 | function P.SettingsButton_clicked(e) |
---|
56 | showMenuSheet("SettingsMenu", true) |
---|
57 | end |
---|
58 | |
---|
59 | function P.CreditsButton_clicked(e) |
---|
60 | showMenuSheet("CreditsMenu", true) |
---|
61 | end |
---|
62 | |
---|
63 | function P.ExitButton_clicked(e) |
---|
64 | orxonox.execute("exit") |
---|
65 | end |
---|
66 | |
---|
67 | return P |
---|
68 | |
---|