Fix Enter Game window not being centered on startup
This commit is contained in:
parent
596717bf32
commit
6edc73a8ba
|
@ -124,13 +124,14 @@ function EnterGame.init()
|
|||
|
||||
|
||||
clientBox = enterGame:getChildById('clientComboBox')
|
||||
connect(clientBox, { onOptionChange = EnterGame.onClientVersionChange })
|
||||
|
||||
for _, proto in pairs(g_game.getSupportedClients()) do
|
||||
clientBox:addOption(proto)
|
||||
end
|
||||
clientBox:setCurrentOption(clientVersion)
|
||||
|
||||
EnterGame.toggleAuthenticatorToken(clientVersion, true)
|
||||
connect(clientBox, { onOptionChange = EnterGame.onClientVersionChange })
|
||||
|
||||
enterGame:hide()
|
||||
|
||||
if g_app.isRunning() and not g_game.isOnline() then
|
||||
|
@ -220,7 +221,8 @@ function EnterGame.clearAccountFields()
|
|||
g_settings.remove('password')
|
||||
end
|
||||
|
||||
function EnterGame.toggleAuthenticatorToken(enabled)
|
||||
function EnterGame.toggleAuthenticatorToken(clientVersion, init)
|
||||
local enabled = (clientVersion >= 1072)
|
||||
if enabled == enterGame.authenticatorEnabled then
|
||||
return
|
||||
end
|
||||
|
@ -232,9 +234,11 @@ function EnterGame.toggleAuthenticatorToken(enabled)
|
|||
local serverLabel = enterGame:getChildById('serverLabel')
|
||||
serverLabel:setMarginTop(serverLabel:getMarginTop() + enterGame.authenticatorHeight)
|
||||
|
||||
if not init then
|
||||
enterGame:breakAnchors()
|
||||
enterGame:setY(enterGame:getY() - enterGame.authenticatorHeight)
|
||||
enterGame:bindRectToParent()
|
||||
end
|
||||
|
||||
enterGame:setHeight(enterGame:getHeight() + enterGame.authenticatorHeight)
|
||||
else
|
||||
|
@ -244,9 +248,11 @@ function EnterGame.toggleAuthenticatorToken(enabled)
|
|||
local serverLabel = enterGame:getChildById('serverLabel')
|
||||
serverLabel:setMarginTop(serverLabel:getMarginTop() - enterGame.authenticatorHeight)
|
||||
|
||||
if not init then
|
||||
enterGame:breakAnchors()
|
||||
enterGame:setY(enterGame:getY() + enterGame.authenticatorHeight)
|
||||
enterGame:bindRectToParent()
|
||||
end
|
||||
|
||||
enterGame:setHeight(enterGame:getHeight() - enterGame.authenticatorHeight)
|
||||
end
|
||||
|
@ -256,7 +262,7 @@ end
|
|||
|
||||
function EnterGame.onClientVersionChange(comboBox, text, data)
|
||||
local clientVersion = tonumber(text)
|
||||
EnterGame.toggleAuthenticatorToken(clientVersion >= 1072)
|
||||
EnterGame.toggleAuthenticatorToken(clientVersion)
|
||||
end
|
||||
|
||||
function EnterGame.doLogin()
|
||||
|
|
Loading…
Reference in New Issue