lua scripting

This commit is contained in:
Eduardo Bart
2011-04-21 19:44:30 -03:00
parent bb05338190
commit 50b99a75b9
27 changed files with 674 additions and 145 deletions

View File

View File

@@ -1,22 +0,0 @@
MainMenuController = {}
enterGameController = {}
function enterGameController.enterGameButton_clicked()
createEnterGameWindow()
end
function mainMenuController.createMainMenu()
mainMenuPanel = loadUI("ui/mainMenuPanel.yml")
enterGameButton = mainMenuPanel:getElementById("enterGameButton")
enterGameButton.setOnClick(enterGameController.enterGameButton_clicked)
exitButton = mainMenuPanel:getElementById("exitButton")
exitButton:setOnClick(function() exitGame() end)
end
function onEnter()
mainMenuController:createMainMenu()
end
function onLeave()
end

View File

@@ -49,6 +49,9 @@ window#enterGameWindow:
anchors.bottom: parent.bottom
margin.bottom: 10
margin.right: 13
onClick: |
enterGameWindow:destroy()
enterGameWindow = nil
textEdit#accountNameTextEdit:
anchors.right: parent.right

View File

@@ -1 +0,0 @@
require("modules/mainmenu/mainmenu")

View File

@@ -1 +1,23 @@
loadUI("modules/mainmenu/mainmenu.yml")
-- events
function MainMenu_enterGameClicked()
enterGameWindow = loadUI("modules/mainmenu/entergamewindow.yml")
end
function MainMenu_optionsClicked()
optionsWindow = loadUI("modules/mainmenu/optionswindow.yml")
end
function MainMenu_infoClicked()
infoWindow = loadUI("modules/mainmenu/infowindow.yml")
end
function MainMenu_exitClicked()
exitGame()
end
-- create main menu
function MainMenu_create()
menuPanel = loadUI("modules/mainmenu/mainmenu.yml")
end
MainMenu_create()

View File

@@ -11,6 +11,7 @@ panel#mainMenu:
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 16
onClick: MainMenu_enterGameClicked()
button#accessAccountButton:
text: Access Account
@@ -23,15 +24,18 @@ panel#mainMenu:
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 76
onClick: MainMenu_optionsClicked()
button#infoButton:
text: Info
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 106
onClick: MainMenu_infoClicked()
button#exitGameButton:
text: Exit
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 136
margin.top: 136
onClick: MainMenu_exitClicked()

View File

@@ -108,4 +108,7 @@ window#optionsWindow:
anchors.right: parent.right
anchors.bottom: parent.bottom
margin.right: 10
margin.bottom: 13
margin.bottom: 13
onClick: |
optionsWindow:destroy()
optionsWindow = nil

View File

@@ -1,37 +0,0 @@
panel#mainMenu:
skin: roundedGridPanel
size: [117, 171]
anchors.left: parent.left
anchors.bottom: parent.bottom
margin.left: 60
margin.bottom: 70
button#enterGameButton:
text: Enter Game
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 16
button#accessAccountButton:
text: Access Account
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 46
button#optionsButton:
text: Options
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 76
button#infoButton:
text: Info
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 106
button#exitGameButton:
text: Exit
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 136