Fix bug when closing character list
This commit is contained in:
parent
4c3b284f0e
commit
a8771e86ad
|
@ -138,7 +138,12 @@ function CharacterList.terminate()
|
||||||
disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox })
|
disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox })
|
||||||
disconnect(g_game, { onLoginWait = onLoginWait })
|
disconnect(g_game, { onLoginWait = onLoginWait })
|
||||||
disconnect(g_game, { onGameEnd = CharacterList.showAgain })
|
disconnect(g_game, { onGameEnd = CharacterList.showAgain })
|
||||||
CharacterList.destroy()
|
|
||||||
|
if charactersWindow then
|
||||||
|
characterList = nil
|
||||||
|
charactersWindow:destroy()
|
||||||
|
charactersWindow = nil
|
||||||
|
end
|
||||||
|
|
||||||
if loadBox then
|
if loadBox then
|
||||||
g_game.cancelLogin()
|
g_game.cancelLogin()
|
||||||
|
@ -166,6 +171,10 @@ end
|
||||||
|
|
||||||
function CharacterList.create(characters, account, otui)
|
function CharacterList.create(characters, account, otui)
|
||||||
if not otui then otui = 'characterlist.otui' end
|
if not otui then otui = 'characterlist.otui' end
|
||||||
|
|
||||||
|
if charactersWindow then
|
||||||
|
charactersWindow:destroy()
|
||||||
|
end
|
||||||
|
|
||||||
charactersWindow = g_ui.displayUI(otui)
|
charactersWindow = g_ui.displayUI(otui)
|
||||||
characterList = charactersWindow:getChildById('characters')
|
characterList = charactersWindow:getChildById('characters')
|
||||||
|
@ -220,6 +229,8 @@ function CharacterList.create(characters, account, otui)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterList.destroy()
|
function CharacterList.destroy()
|
||||||
|
charactersWindow:hide()
|
||||||
|
|
||||||
if charactersWindow then
|
if charactersWindow then
|
||||||
characterList = nil
|
characterList = nil
|
||||||
charactersWindow:destroy()
|
charactersWindow:destroy()
|
||||||
|
@ -262,7 +273,7 @@ function CharacterList.doLogin()
|
||||||
local charInfo = { worldHost = selected.worldHost,
|
local charInfo = { worldHost = selected.worldHost,
|
||||||
worldPort = selected.worldPort,
|
worldPort = selected.worldPort,
|
||||||
characterName = selected.characterName }
|
characterName = selected.characterName }
|
||||||
CharacterList.hide()
|
charactersWindow:hide()
|
||||||
tryLogin(charInfo)
|
tryLogin(charInfo)
|
||||||
else
|
else
|
||||||
displayErrorBox(tr('Error'), tr('You must select a character to login!'))
|
displayErrorBox(tr('Error'), tr('You must select a character to login!'))
|
||||||
|
|
Loading…
Reference in New Issue