mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
lua scripting
This commit is contained in:
@@ -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
|
@@ -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
|
@@ -1 +0,0 @@
|
||||
require("modules/mainmenu/mainmenu")
|
@@ -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()
|
@@ -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()
|
@@ -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
|
@@ -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
|
Reference in New Issue
Block a user