Allow to set default server in entergame

This commit is contained in:
Eduardo Bart 2012-08-23 14:45:39 -03:00
parent e25bd7fe54
commit 112d584b66
3 changed files with 33 additions and 5 deletions

View File

@ -105,7 +105,7 @@ function EnterGame.firstShow()
local host = g_settings.get('host')
local autologin = g_settings.getBoolean('autologin')
if #host > 0 and #password > 0 and #account > 0 and autologin then
addEvent(EnterGame.doLogin)
autoLogiEvent = addEvent(EnterGame.doLogin)
end
end
@ -148,6 +148,7 @@ function EnterGame.clearAccountFields()
end
function EnterGame.doLogin()
autoLogiEvent = nil
G.account = enterGame:getChildById('accountNameTextEdit'):getText()
G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
G.host = enterGame:getChildById('serverHostTextEdit'):getText()
@ -192,6 +193,26 @@ function EnterGame.displayMotd()
displayInfoBox(tr('Message of the day'), G.motdMessage)
end
function EnterGame.setDefaultServer(host, port, protocol)
local hostTextEdit = enterGame:getChildById('serverHostTextEdit')
local portTextEdit = enterGame:getChildById('serverPortTextEdit')
local protocolLabel = enterGame:getChildById('protocolLabel')
local accountTextEdit = enterGame:getChildById('accountNameTextEdit')
local passwordTextEdit = enterGame:getChildById('accountPasswordTextEdit')
if hostTextEdit:getText() ~= host then
hostTextEdit:setText(host)
portTextEdit:setText(port)
protocolBox:setCurrentOption(protocol)
accountTextEdit:setText('')
passwordTextEdit:setText('')
if autoLogiEvent then
autoLogiEvent:cancel()
end
end
end
function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeight)
local hostTextEdit = enterGame:getChildById('serverHostTextEdit')
hostTextEdit:setText(host)

View File

@ -70,8 +70,12 @@ end
function Locales.terminate()
installedLocales = nil
currentLocale = nil
if localeComboBox then
localeComboBox:destroy()
localeComboBox = nil
end
Extended.unregister(ExtendedLocales)
disconnect(g_game, { onGameStart = onGameStart })
end

View File

@ -31,9 +31,12 @@ function UITable:onDestroy()
self.columns = {}
self.headerRow = {}
self.selectedRow = nil
if self.dataSpace then
self.dataSpace:destroyChildren()
self.dataSpace = nil
end
end
function UITable:onStyleApply(styleName, styleNode)
for name, value in pairs(styleNode) do