mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 20:14:54 +02:00
restore some game functionallity
* i'm gradually restoring game functionality with the new modules design, though still a lot to do * you can reload all scripts and modules using Ctrl+R shortcut while playing (finally! this is the reason of all this rework) * a bunch of fixes, but new regression too :P * fix performance issue that could lead freezes in the client in older machines * completely new game module with new design * fix crashs in map render * remove uigame.cpp (now every game input is via lua) * enable DEBUG macro by default, with it you are able to view any possible lua leak while running
This commit is contained in:
@@ -52,7 +52,6 @@ local function tryLogin(charInfo, tries)
|
||||
Settings.set('lastUsedCharacter', charInfo.characterName)
|
||||
end
|
||||
|
||||
|
||||
function onGameLoginError(message)
|
||||
CharacterList.destroyLoadBox()
|
||||
local errorBox = displayErrorBox("Login Error", "Login error: " .. message)
|
||||
@@ -67,6 +66,10 @@ end
|
||||
|
||||
-- public functions
|
||||
function CharacterList.init()
|
||||
charactersWindow = displayUI('characterlist.otui')
|
||||
charactersWindow:hide()
|
||||
characterList = charactersWindow:getChildById('characterList')
|
||||
charactersWindow.onKeyPress = onCharactersWindowKeyPress
|
||||
connect(g_game, { onLoginError = onGameLoginError })
|
||||
connect(g_game, { onConnectionError = onGameConnectionError })
|
||||
connect(g_game, { onGameStart = CharacterList.destroyLoadBox })
|
||||
@@ -74,11 +77,13 @@ function CharacterList.init()
|
||||
end
|
||||
|
||||
function CharacterList.terminate()
|
||||
disconnect(g_game, { onLoginError = onGameLoginError })
|
||||
disconnect(g_game, { onConnectionError = onGameConnectionError })
|
||||
disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox })
|
||||
disconnect(g_game, { onGameEnd = CharacterList.show })
|
||||
characterList = nil
|
||||
if charactersWindow then
|
||||
charactersWindow:destroy()
|
||||
charactersWindow = nil
|
||||
end
|
||||
charactersWindow:destroy()
|
||||
charactersWindow = nil
|
||||
if loadBox then
|
||||
g_game.cancelLogin()
|
||||
loadBox:destroy()
|
||||
@@ -88,14 +93,9 @@ function CharacterList.terminate()
|
||||
end
|
||||
|
||||
function CharacterList.create(characters, premDays)
|
||||
if charactersWindow then
|
||||
charactersWindow:destroy()
|
||||
end
|
||||
|
||||
charactersWindow = displayUI('characterlist.otui')
|
||||
characterList = charactersWindow:getChildById('characterList')
|
||||
CharacterList.show()
|
||||
characterList:destroyChildren()
|
||||
local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel')
|
||||
connect(charactersWindow, {onKeyPress = onCharactersWindowKeyPress })
|
||||
|
||||
local focusLabel
|
||||
for i,characterInfo in ipairs(characters) do
|
||||
|
Reference in New Issue
Block a user