mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
remove game state classes
scripting improvements
This commit is contained in:
@@ -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
|
||||
|
@@ -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()
|
@@ -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()
|
@@ -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()
|
20
data/modules/mainmenu/menustate.lua
Normal file
20
data/modules/mainmenu/menustate.lua
Normal 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
|
10
data/modules/mainmenu/module.yml
Normal file
10
data/modules/mainmenu/module.yml
Normal 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
|
@@ -110,5 +110,4 @@ window#optionsWindow:
|
||||
margin.right: 10
|
||||
margin.bottom: 13
|
||||
onClick: |
|
||||
optionsWindow:destroy()
|
||||
optionsWindow = nil
|
||||
self:getParent():destroy()
|
Reference in New Issue
Block a user