[5661] | 1 | -- MainMenu.lua |
---|
[5491] | 2 | |
---|
[6746] | 3 | local P = createMenuSheet("MainMenu") |
---|
[11502] | 4 | P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "HighscoreMenu", "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, { |
---|
[11502] | 24 | ["button"] = winMgr:getWindow("orxonox/HighscoreButton"), |
---|
| 25 | ["callback"] = P.MultiplayerButton_clicked |
---|
| 26 | }) |
---|
| 27 | |
---|
| 28 | P:setButton(5, 1, { |
---|
[7689] | 29 | ["button"] = winMgr:getWindow("orxonox/SettingsButton"), |
---|
[8079] | 30 | ["callback"] = P.SettingsButton_clicked |
---|
| 31 | }) |
---|
[7689] | 32 | |
---|
[11502] | 33 | P:setButton(6, 1, { |
---|
[7689] | 34 | ["button"] = winMgr:getWindow("orxonox/CreditsButton"), |
---|
[8079] | 35 | ["callback"] = P.CreditsButton_clicked |
---|
| 36 | }) |
---|
[7689] | 37 | |
---|
[11502] | 38 | P:setButton(7, 1, { |
---|
[7689] | 39 | ["button"] = winMgr:getWindow("orxonox/ExitButton"), |
---|
[8079] | 40 | ["callback"] = P.ExitButton_clicked |
---|
| 41 | }) |
---|
[7689] | 42 | end |
---|
| 43 | |
---|
[6417] | 44 | -- events for MainMenu |
---|
| 45 | function P.QuickGameTestButton_clicked(e) |
---|
[7163] | 46 | hideAllMenuSheets() |
---|
[6417] | 47 | orxonox.execute("startGame") |
---|
[5491] | 48 | end |
---|
| 49 | |
---|
[6417] | 50 | function P.SingleplayerButton_clicked(e) |
---|
[6746] | 51 | showMenuSheet("SingleplayerMenu", true) |
---|
[5491] | 52 | end |
---|
| 53 | |
---|
[6417] | 54 | function P.MultiplayerButton_clicked(e) |
---|
[6746] | 55 | showMenuSheet("MultiplayerMenu", true) |
---|
[5491] | 56 | end |
---|
| 57 | |
---|
[11502] | 58 | function P.HighscoreButton_clicked(e) |
---|
| 59 | showMenuSheet("HighscoreMenu", true) |
---|
| 60 | end |
---|
| 61 | |
---|
[6417] | 62 | function P.SettingsButton_clicked(e) |
---|
[6746] | 63 | showMenuSheet("SettingsMenu", true) |
---|
[5491] | 64 | end |
---|
| 65 | |
---|
[6417] | 66 | function P.CreditsButton_clicked(e) |
---|
[6746] | 67 | showMenuSheet("CreditsMenu", true) |
---|
[5491] | 68 | end |
---|
| 69 | |
---|
[6417] | 70 | function P.ExitButton_clicked(e) |
---|
| 71 | orxonox.execute("exit") |
---|
[5491] | 72 | end |
---|
| 73 | |
---|
[5661] | 74 | return P |
---|
[5491] | 75 | |
---|