mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
much faster layout calculation
This commit is contained in:
@@ -15,14 +15,16 @@ function Console.onLog(level, message, time)
|
||||
if level == LogDebug then
|
||||
color = '#5555ff'
|
||||
elseif level == LogInfo then
|
||||
color = '#55ff55'
|
||||
color = '#5555ff'
|
||||
elseif level == LogWarning then
|
||||
color = '#ffff00'
|
||||
else
|
||||
color = '#ff0000'
|
||||
end
|
||||
|
||||
Console.addLine(message, color)
|
||||
if level ~= LogDebug then
|
||||
Console.addLine(message, color)
|
||||
end
|
||||
|
||||
logLocked = false
|
||||
end
|
||||
@@ -35,12 +37,17 @@ function Console.addLine(text, color)
|
||||
label:setStyle('ConsoleLabel')
|
||||
label:setText(text)
|
||||
label:setForegroundColor(color)
|
||||
console:insertChild(label, -1)
|
||||
console:insertChild(3, label)
|
||||
|
||||
local lastLabel = console:getChildByIndex(4)
|
||||
if lastLabel then
|
||||
lastLabel:addAnchor(AnchorBottom, "prev", AnchorTop)
|
||||
end
|
||||
|
||||
numLines = numLines + 1
|
||||
if numLines > maxLines then
|
||||
local firstLine = console:getChildByIndex(0)
|
||||
firstLine:destroy()
|
||||
local firstLabel = console:getChildByIndex(-1)
|
||||
firstLabel:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user