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