1 | -- MainMenu.lua |
---|
2 | |
---|
3 | local P = createMenuSheet("MainMenu") |
---|
4 | P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" } |
---|
5 | |
---|
6 | P.buttonList = {} |
---|
7 | |
---|
8 | P.testArray = {} |
---|
9 | |
---|
10 | |
---|
11 | function P.onLoad() |
---|
12 | local item = { |
---|
13 | ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"), |
---|
14 | ["function"] = P.QuickGameTestButton_clicked |
---|
15 | } |
---|
16 | table.insert(P.buttonList,item) |
---|
17 | |
---|
18 | item = { |
---|
19 | ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"), |
---|
20 | ["function"] = P.SingleplayerButton_clicked |
---|
21 | } |
---|
22 | table.insert(P.buttonList,item) |
---|
23 | |
---|
24 | item = { |
---|
25 | ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"), |
---|
26 | ["function"] = P.MultiplayerButton_clicked |
---|
27 | } |
---|
28 | table.insert(P.buttonList,item) |
---|
29 | |
---|
30 | item = { |
---|
31 | ["button"] = winMgr:getWindow("orxonox/SettingsButton"), |
---|
32 | ["function"] = P.SettingsButton_clicked |
---|
33 | } |
---|
34 | table.insert(P.buttonList,item) |
---|
35 | |
---|
36 | item = { |
---|
37 | ["button"] = winMgr:getWindow("orxonox/CreditsButton"), |
---|
38 | ["function"] = P.CreditsButton_clicked |
---|
39 | } |
---|
40 | table.insert(P.buttonList,item) |
---|
41 | |
---|
42 | item = { |
---|
43 | ["button"] = winMgr:getWindow("orxonox/ExitButton"), |
---|
44 | ["function"] = P.ExitButton_clicked |
---|
45 | } |
---|
46 | table.insert(P.buttonList,item) |
---|
47 | end |
---|
48 | |
---|
49 | function P.onShow() |
---|
50 | P.oldindex = -2 |
---|
51 | P.index = -1 |
---|
52 | end |
---|
53 | |
---|
54 | -- events for MainMenu |
---|
55 | function P.QuickGameTestButton_clicked(e) |
---|
56 | hideAllMenuSheets() |
---|
57 | orxonox.execute("startGame") |
---|
58 | end |
---|
59 | |
---|
60 | function P.SingleplayerButton_clicked(e) |
---|
61 | showMenuSheet("SingleplayerMenu", true) |
---|
62 | end |
---|
63 | |
---|
64 | function P.MultiplayerButton_clicked(e) |
---|
65 | showMenuSheet("MultiplayerMenu", true) |
---|
66 | end |
---|
67 | |
---|
68 | function P.SettingsButton_clicked(e) |
---|
69 | showMenuSheet("SettingsMenu", true) |
---|
70 | end |
---|
71 | |
---|
72 | function P.CreditsButton_clicked(e) |
---|
73 | showMenuSheet("CreditsMenu", true) |
---|
74 | end |
---|
75 | |
---|
76 | function P.ExitButton_clicked(e) |
---|
77 | orxonox.execute("exit") |
---|
78 | end |
---|
79 | |
---|
80 | |
---|
81 | --[[ |
---|
82 | list = {} |
---|
83 | local item = |
---|
84 | { |
---|
85 | ["button"] = buttonWindow, |
---|
86 | ["function"] = buttonFunction, |
---|
87 | } |
---|
88 | table.insert(list, item) |
---|
89 | item = list[i] |
---|
90 | |
---|
91 | for i,item in pairs(list) do |
---|
92 | button = item["button"] |
---|
93 | end |
---|
94 | |
---|
95 | --]] |
---|
96 | --[[ |
---|
97 | function createList() |
---|
98 | list = {} |
---|
99 | |
---|
100 | local j |
---|
101 | while j < P.loadAlong |
---|
102 | local item = |
---|
103 | { |
---|
104 | ["button"] = buttonWindow, |
---|
105 | ["function"] = buttonFunction, |
---|
106 | } |
---|
107 | table.insert(list, item) |
---|
108 | end |
---|
109 | |
---|
110 | --]] |
---|
111 | |
---|
112 | function P.onKeyPressed() |
---|
113 | cout(0,code) |
---|
114 | buttonIteratorHelper(P.buttonList, code, P, 6, 1) |
---|
115 | --indexTester(P.buttonList,code,P,6,1) |
---|
116 | end |
---|
117 | |
---|
118 | return P |
---|
119 | |
---|