more scripting features (dynamic fields)

This commit is contained in:
Eduardo Bart
2011-05-02 01:13:57 -03:00
parent f7bb044f48
commit 9e90ae0ee4
19 changed files with 378 additions and 146 deletions

View File

@@ -3,8 +3,7 @@ window#enterGameWindow:
size: [236, 178]
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: self:getParent():lock(self)
onDestroy: self:getParent():unlock(self)
onLoad: self.locked = true
label#accountNameLabel:
text: Account name
@@ -52,7 +51,7 @@ window#enterGameWindow:
anchors.bottom: parent.bottom
margin.bottom: 10
margin.right: 13
onClick: self:getParent():destroy()
onClick: self.parent:destroy()
textEdit#accountNameTextEdit:
anchors.right: parent.right

View File

@@ -3,8 +3,7 @@ window#infoWindow:
size: [244, 221]
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: self:getParent():lock(self)
onDestroy: self:getParent():unlock(self)
onLoad: self.locked = true
panel#infoPanel:
skin: flatPanel
@@ -60,4 +59,4 @@ window#infoWindow:
anchors.top: parent.top
margin.top: 191
margin.left: 188
onClick: self:getParent():destroy()
onClick: self.parent:destroy()

View File

@@ -49,4 +49,4 @@ panel#background:
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 136
onClick: App.exit()
onClick: onApplicationClose()

View File

@@ -5,11 +5,12 @@ end
function onLeaveMenuState()
mainMenu:destroy()
mainMenu = nil
end
function onApplicationClose()
onLeaveMenuState()
exitGame()
App.exit()
end
-- here is where everything starts

View File

@@ -3,8 +3,7 @@ window#optionsWindow:
size: [286, 262]
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: self:getParent():lock(self)
onDestroy: self:getParent():unlock(self)
onLoad: self.locked = true
# general
button#generalButton:
@@ -111,4 +110,4 @@ window#optionsWindow:
anchors.bottom: parent.bottom
margin.right: 10
margin.bottom: 13
onClick: self:getParent():destroy()
onClick: self.parent:destroy()

View File

@@ -1,12 +1,11 @@
function messageBox(title, text)
local messageBoxWindow = UI.load("modules/messagebox/messagebox.yml")
local messageBoxLabel = messageBoxWindow:getChildByID("messageBoxLabel")
local messageBoxOkButton = messageBoxWindow:getChildByID("messageBoxOkButton")
local uiRoot = UI.getRootContainer()
uiRoot:lock(messageBoxWindow)
messageBoxWindow:setTitle(title)
messageBoxLabel:setText(text)
local messageBoxLabel = messageBoxWindow:getChildById("messageBoxLabel")
local messageBoxOkButton = messageBoxWindow:getChildById("messageBoxOkButton")
messageBoxWindow.locked = true
messageBoxWindow.title = title
messageBoxLabel.text = text
--messageBoxWindow:setSize(messageBoxLabel:getSize() + Size{20, 20})
messageBoxWindow:setOnDestroy(function() uiRoot:unlock(self) end)
messageBoxOkButton:setOnClick(function() messageBoxWindow:destroy() end)
messageBoxWindow.onDestroy = function() self.locked = false end
messageBoxOkButton.onClick = function() messageBoxWindow:destroy() end
end