mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
basic charlist
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
local account
|
||||
local password
|
||||
|
||||
function EnterGame_characterWindow_okClicked()
|
||||
local charactersWindow = UI.root:getChildById('charactersWindow')
|
||||
local selected = charactersWindow:getChildById('charactersList'):getFocusedChild()
|
||||
if selected then
|
||||
Game.loginWorld(account, password, selected.worldHost, selected.worldPort, selected.characterName)
|
||||
charactersWindow:destroy()
|
||||
mainMenu:hide()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function EnterGame_connectToLoginServer()
|
||||
local protocolLogin = ProtocolLogin.create()
|
||||
|
||||
@@ -27,12 +41,31 @@ function EnterGame_connectToLoginServer()
|
||||
displayInfoBox("Message of the day", motdText)
|
||||
Configs.set("motd", motdNumber)
|
||||
end
|
||||
mainMenu:hide()
|
||||
end
|
||||
|
||||
protocolLogin.onCharacterList = function(protocol, characters, premDays)
|
||||
loadBox:destroy()
|
||||
local charactersWindow = UI.loadAndDisplayLocked('/mainmenu/ui/charlist.otui')
|
||||
local charactersList = charactersWindow:getChildById('charactersList')
|
||||
for i,characterInfo in ipairs(characters) do
|
||||
local characterName = characterInfo[1]
|
||||
local worldName = characterInfo[2]
|
||||
local worldHost = characterInfo[3]
|
||||
local worldIp = characterInfo[4]
|
||||
|
||||
local label = UILabel.create()
|
||||
charactersList:addChild(label)
|
||||
label:setText(characterName .. ' (' .. worldName .. ')')
|
||||
label:setStyle('CharactersListLabel')
|
||||
label.characterName = characterName
|
||||
label.worldHost = worldHost
|
||||
label.worldPort = worldIp
|
||||
end
|
||||
end
|
||||
|
||||
local enterGameWindow = UI.root:getChildById("enterGameWindow")
|
||||
local account = enterGameWindow:getChildById("accountNameLineEdit"):getText()
|
||||
local password = enterGameWindow:getChildById("accountPasswordLineEdit"):getText()
|
||||
account = enterGameWindow:getChildById("accountNameLineEdit"):getText()
|
||||
password = enterGameWindow:getChildById("accountPasswordLineEdit"):getText()
|
||||
protocolLogin:login(account, password)
|
||||
|
||||
enterGameWindow:destroy()
|
||||
|
@@ -1,3 +1,16 @@
|
||||
CharactersListLabel < Label
|
||||
image: /core_ui/images/empty_rect.png
|
||||
font: helvetica-12px-bold
|
||||
background-color: #00000000
|
||||
focusable: true
|
||||
margin.left: 1
|
||||
margin.right: 1
|
||||
margin.top: 1
|
||||
|
||||
state.focus:
|
||||
background-color: #ffffff22
|
||||
color: #ffffff
|
||||
|
||||
MainWindow
|
||||
id: charactersWindow
|
||||
title: Charlist
|
||||
@@ -19,6 +32,7 @@ MainWindow
|
||||
anchors.bottom: parent.bottom
|
||||
margin.bottom: 16
|
||||
margin.right: 16
|
||||
onClick: EnterGame_characterWindow_okClicked()
|
||||
|
||||
Button
|
||||
id: buttonCancel
|
||||
|
Reference in New Issue
Block a user