remove game state classes

scripting improvements
This commit is contained in:
Eduardo Bart
2011-04-22 10:49:46 -03:00
parent a3901b0251
commit e611734396
32 changed files with 428 additions and 435 deletions

View File

@@ -50,8 +50,8 @@ window#enterGameWindow:
margin.bottom: 10
margin.right: 13
onClick: |
enterGameWindow:destroy()
enterGameWindow = nil
self:getParent():destroy()
self:getParent():getParent():unlock()
textEdit#accountNameTextEdit:
anchors.right: parent.right

View File

@@ -57,4 +57,6 @@ window#infoWindow:
anchors.left: parent.left
anchors.top: parent.top
margin.top: 191
margin.left: 188
margin.left: 188
onClick: |
self:getParent():destroy()

View File

@@ -1,6 +1,15 @@
-- events
-- main menu methods
function MainMenu_create()
mainMenu = loadUI("modules/mainmenu/mainmenu.yml")
end
function MainMenu_destroy()
mainMenu:destroy()
end
function MainMenu_enterGameClicked()
enterGameWindow = loadUI("modules/mainmenu/entergamewindow.yml")
enterGameWindow:getParent():lock(enterGameWindow)
end
function MainMenu_optionsClicked()
@@ -12,12 +21,5 @@ function MainMenu_infoClicked()
end
function MainMenu_exitClicked()
exitGame()
onApplicationClose()
end
-- create main menu
function MainMenu_create()
menuPanel = loadUI("modules/mainmenu/mainmenu.yml")
end
MainMenu_create()

View File

@@ -1,41 +1,51 @@
panel#mainMenu:
skin: roundedGridPanel
size: [117, 171]
panel#background:
skin:
image: background.png
antialised: true
size: [500, 500]
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
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
onClick: MainMenu_enterGameClicked()
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
onClick: MainMenu_enterGameClicked()
button#accessAccountButton:
text: Access Account
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 46
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
onClick: MainMenu_optionsClicked()
button#optionsButton:
text: Options
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#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
onClick: MainMenu_exitClicked()
button#exitGameButton:
text: Exit
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 136
onClick: MainMenu_exitClicked()

View File

@@ -0,0 +1,20 @@
-- menu state
function onEnterMenuState()
MainMenu_create()
end
function onLeaveMenuState()
MainMenu_destroy()
end
function onApplicationClose()
onLeaveMenuState()
exitGame()
end
-- here is where everything starts
if not initialStateLoaded then
onEnterMenuState()
setOnApplicationClose(onApplicationClose)
initialStateLoaded = true
end

View File

@@ -0,0 +1,10 @@
title: Main menu
notes: Used to create the main menu
enabled: true
#dependencies
interface: 020
author: edubart
version: 0.2
scripts:
- menustate.lua
- mainmenu.lua

View File

@@ -110,5 +110,4 @@ window#optionsWindow:
margin.right: 10
margin.bottom: 13
onClick: |
optionsWindow:destroy()
optionsWindow = nil
self:getParent():destroy()