configure server host and port in enter game

This commit is contained in:
Eduardo Bart
2011-11-16 18:07:52 -02:00
parent 9159e14895
commit fa8291a433
8 changed files with 67 additions and 23 deletions

View File

@@ -48,16 +48,16 @@ MainWindow
margin.right: 16
margin.bottom: 10
CheckBox
id: charAutoLoginBox
text: Auto login
tooltip: Auto login selected character on next charlist load
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: next.top
margin.bottom: 6
margin.left: 18
margin.right: 18
//CheckBox
// id: charAutoLoginBox
// text: Auto login
// tooltip: Auto login selected character on next charlist load
// anchors.left: parent.left
// anchors.right: parent.right
// anchors.bottom: next.top
// margin.bottom: 6
// margin.left: 18
// margin.right: 18
Button
id: buttonOk

View File

@@ -49,17 +49,19 @@ function EnterGame.create()
local account = Configs.get('account')
local password = Configs.get('password')
local host = Configs.get('host')
local port = tonumber(Configs.get('port'))
local autologin = toboolean(Configs.get('autologin'))
enterGame:getChildById('accountNameLineEdit'):setText(account)
enterGame:getChildById('accountPasswordLineEdit'):setText(password)
enterGame:getChildById('serverHostLineEdit'):setText(host)
enterGame:getChildById('serverPortLineEdit'):setText(port)
enterGame:getChildById('autoLoginBox'):setChecked(autologin)
enterGame:getChildById('rememberPasswordBox'):setChecked(#account > 0)
if #account > 0 then
enterGame:getChildById('rememberPasswordBox'):setChecked(true)
if autologin then
enterGame:getChildById('autoLoginBox'):setChecked(true)
addEvent(EnterGame.doLogin)
end
if #account > 0 and autologin then
addEvent(EnterGame.doLogin)
end
end
@@ -80,8 +82,13 @@ end
function EnterGame.doLogin()
EnterGame.account = enterGame:getChildById('accountNameLineEdit'):getText()
EnterGame.password = enterGame:getChildById('accountPasswordLineEdit'):getText()
EnterGame.host = enterGame:getChildById('serverHostLineEdit'):getText()
EnterGame.port = enterGame:getChildById('serverPortLineEdit'):getText()
EnterGame.hide()
Configs.set('host', EnterGame.host)
Configs.set('port', EnterGame.port)
local protocolLogin = ProtocolLogin.create()
protocolLogin.onError = onError
protocolLogin.onMotd = onMotd
@@ -93,7 +100,7 @@ function EnterGame.doLogin()
EnterGame.show()
end
protocolLogin:login(EnterGame.account, EnterGame.password)
protocolLogin:login(EnterGame.host, EnterGame.port, EnterGame.account, EnterGame.password)
end
function EnterGame.displayMotd()

View File

@@ -1,7 +1,7 @@
MainWindow
id: enterGame
title: Enter Game
size: 236 200
size: 236 240
onEnter: EnterGame.doLogin()
onEscape: EnterGame.hide()
@@ -36,6 +36,38 @@ MainWindow
margin.left: 18
margin.right: 18
LargerLabel
id: serverLabel
width: 140
text: Server
anchors.left: prev.left
anchors.top: prev.bottom
margin.top: 8
LineEdit
id: serverHostLineEdit
tooltip: Only protocol 8.62 is supported
anchors.left: serverLabel.left
anchors.right: serverLabel.right
anchors.top: serverLabel.bottom
margin.top: 2
LargerLabel
id: portLabel
text: Port
width: 50
anchors.left: serverLabel.right
anchors.top: serverLabel.top
margin.left: 10
LineEdit
id: serverPortLineEdit
text: 7171
anchors.left: portLabel.left
anchors.right: portLabel.right
anchors.top: portLabel.bottom
margin.top: 2
CheckBox
id: rememberPasswordBox
text: Remember password