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