|
|
|
@ -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()
|
|
|
|
|