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