scripting and UI improvements

This commit is contained in:
Eduardo Bart
2011-05-01 15:47:35 -03:00
parent 3960240b8e
commit 32a8ed3871
23 changed files with 424 additions and 293 deletions

View File

@@ -4,22 +4,22 @@ window#enterGameWindow:
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: self:getParent():lock(self)
onDestroy: self:getParent():unlock()
onDestroy: self:getParent():unlock(self)
label#accountNameLabel:
text: Account name
anchors.left: parent.left
anchors.top: parent.top
margin.left: 18
margin.top: 33
label#passwordLabel:
text: "Password:"
anchors.left: parent.left
anchors.top: parent.top
margin.left: 18
margin.top: 62
label#createAccountLabel:
text: |
If you don't have
@@ -35,6 +35,7 @@ window#enterGameWindow:
anchors.top: parent.top
margin.top: 94
margin.left: 132
onClick: messageBox("Error", "Not implemented yet")
button#okButton:
text: Ok
@@ -52,7 +53,7 @@ window#enterGameWindow:
margin.bottom: 10
margin.right: 13
onClick: self:getParent():destroy()
textEdit#accountNameTextEdit:
anchors.right: parent.right
anchors.top: parent.top
@@ -63,4 +64,4 @@ window#enterGameWindow:
anchors.right: parent.right
anchors.top: parent.top
margin.top: 61
margin.right: 18
margin.right: 18

View File

@@ -4,8 +4,8 @@ window#infoWindow:
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: self:getParent():lock(self)
onDestroy: self:getParent():unlock()
onDestroy: self:getParent():unlock(self)
panel#infoPanel:
skin: flatPanel
size: [208, 129]
@@ -13,7 +13,7 @@ window#infoWindow:
anchors.top: parent.top
margin.top: 32
margin.left: 18
label#infoLabel:
align: center
text: |-
@@ -30,21 +30,21 @@ window#infoWindow:
anchors.top: parent.top
margin.top: 83
margin.left: 9
label#websiteLabel:
text: Official Website
anchors.left: parent.left
anchors.bottom: parent.bottom
margin.bottom: 14
margin.left: 9
button#websiteButton:
text: Github Page
anchors.right: parent.right
anchors.bottom: parent.bottom
margin.bottom: 9
margin.right: 9
lineDecoration#bottomSeparator:
anchors.left: parent.left
anchors.right: parent.right
@@ -52,7 +52,7 @@ window#infoWindow:
margin.bottom: 40
margin.left: 13
margin.right: 13
button#okButton:
text: Ok
size: [43, 20]
@@ -60,4 +60,4 @@ window#infoWindow:
anchors.top: parent.top
margin.top: 191
margin.left: 188
onClick: self:getParent():destroy()
onClick: self:getParent():destroy()

View File

@@ -7,7 +7,7 @@ panel#background:
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
panel#mainMenu:
skin: roundedGridPanel
size: [117, 171]
@@ -15,13 +15,13 @@ panel#background:
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: loadUI("modules/mainmenu/entergamewindow.yml")
onClick: UI.load("modules/mainmenu/entergamewindow.yml")
button#accessAccountButton:
text: Access Account
@@ -35,18 +35,18 @@ panel#background:
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 76
onClick: loadUI("modules/mainmenu/optionswindow.yml")
onClick: UI.load("modules/mainmenu/optionswindow.yml")
button#infoButton:
text: Info
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 106
onClick: loadUI("modules/mainmenu/infowindow.yml")
onClick: UI.load("modules/mainmenu/infowindow.yml")
button#exitGameButton:
text: Exit
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 136
onClick: exitGame()
onClick: App.exit()

View File

@@ -1,6 +1,6 @@
-- menu state
function onEnterMenuState()
mainMenu = loadUI("modules/mainmenu/mainmenu.yml")
mainMenu = UI.load("modules/mainmenu/mainmenu.yml")
end
function onLeaveMenuState()
@@ -15,6 +15,6 @@ end
-- here is where everything starts
if not initialStateLoaded then
onEnterMenuState()
setOnApplicationClose(onApplicationClose)
App.setOnClose(onApplicationClose)
initialStateLoaded = true
end
end

View File

@@ -4,8 +4,8 @@ window#optionsWindow:
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onLoad: self:getParent():lock(self)
onDestroy: self:getParent():unlock()
onDestroy: self:getParent():unlock(self)
# general
button#generalButton:
text: General
@@ -22,7 +22,7 @@ window#optionsWindow:
anchors.top: parent.top
margin.left: 117
margin.top: 29
# graphics
button#graphicsButton:
text: Graphics
@@ -39,7 +39,7 @@ window#optionsWindow:
anchors.top: parent.top
margin.left: 117
margin.top: 62
# console
button#consoleButton:
text: Console
@@ -54,7 +54,7 @@ window#optionsWindow:
anchors.top: parent.top
margin.left: 117
margin.top: 95
# hotkeys
button#hotkeysButton:
text: Hotkeys
@@ -69,7 +69,7 @@ window#optionsWindow:
anchors.top: parent.top
margin.left: 117
margin.top: 128
lineDecoration#middleSeparator:
anchors.left: parent.left
anchors.right: parent.right
@@ -77,7 +77,7 @@ window#optionsWindow:
margin.bottom: 97
margin.left: 18
margin.right: 18
# motd
button#motdButton:
text: Motd
@@ -94,7 +94,7 @@ window#optionsWindow:
anchors.bottom: parent.bottom
margin.left: 117
margin.bottom: 56
lineDecoration#bottomSeparator:
anchors.left: parent.left
anchors.right: parent.right
@@ -102,7 +102,7 @@ window#optionsWindow:
margin.bottom: 40
margin.left: 13
margin.right: 13
# ok button
button#okButton:
text: Ok
@@ -111,4 +111,4 @@ window#optionsWindow:
anchors.bottom: parent.bottom
margin.right: 10
margin.bottom: 13
onClick: self:getParent():destroy()
onClick: self:getParent():destroy()

View File

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

View File

@@ -3,7 +3,7 @@ window#messageBoxWindow:
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
label#messageBoxLabel:
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top

View File

@@ -16,7 +16,7 @@ buttons:
bottom left corner: [45,157,1,1]
bottom right corner: [130,157,1,1]
center: [46,139,84,18]
down state:
text translate: [1, 1]
bordered image:
@@ -45,7 +45,7 @@ panels:
bottom left corner: [43,230,5,5]
bottom right corner: [48,231,5,5]
center: [11,214,32,32]
flatPanel:
bordered image:
left border: [275,0,1,96]
@@ -57,7 +57,7 @@ panels:
bottom left corner: [2,210,1,1]
bottom right corner: [276,95,1,1]
center: [0, 0, 96, 96]
labels:
default:
font: tibia-10px-antialised
@@ -87,7 +87,7 @@ windows:
bottom left corner: [98,193,4,4]
bottom right corner: [102,193,4,4]
center: [0, 0, 96, 96]
text edits:
default:
default size: [86, 16]
@@ -103,9 +103,8 @@ text edits:
bottom left corner: [308,107,1,1]
bottom right corner: [319,107,1,1]
center: [309,97,10,10]
line decorations:
default:
bordered image:
top border: [2,210,96,2]