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 host = g_settings.get('host')
local autologin = g_settings.getBoolean('autologin') local autologin = g_settings.getBoolean('autologin')
if #host > 0 and #password > 0 and #account > 0 and autologin then if #host > 0 and #password > 0 and #account > 0 and autologin then
addEvent(EnterGame.doLogin) autoLogiEvent = addEvent(EnterGame.doLogin)
end end
end end
@ -148,6 +148,7 @@ function EnterGame.clearAccountFields()
end end
function EnterGame.doLogin() function EnterGame.doLogin()
autoLogiEvent = nil
G.account = enterGame:getChildById('accountNameTextEdit'):getText() G.account = enterGame:getChildById('accountNameTextEdit'):getText()
G.password = enterGame:getChildById('accountPasswordTextEdit'):getText() G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
G.host = enterGame:getChildById('serverHostTextEdit'):getText() G.host = enterGame:getChildById('serverHostTextEdit'):getText()
@ -192,6 +193,26 @@ function EnterGame.displayMotd()
displayInfoBox(tr('Message of the day'), G.motdMessage) displayInfoBox(tr('Message of the day'), G.motdMessage)
end 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) function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeight)
local hostTextEdit = enterGame:getChildById('serverHostTextEdit') local hostTextEdit = enterGame:getChildById('serverHostTextEdit')
hostTextEdit:setText(host) hostTextEdit:setText(host)

View File

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

View File

@ -31,8 +31,11 @@ function UITable:onDestroy()
self.columns = {} self.columns = {}
self.headerRow = {} self.headerRow = {}
self.selectedRow = nil self.selectedRow = nil
if self.dataSpace then
self.dataSpace:destroyChildren() self.dataSpace:destroyChildren()
self.dataSpace = nil self.dataSpace = nil
end
end end
function UITable:onStyleApply(styleName, styleNode) function UITable:onStyleApply(styleName, styleNode)