Fixes errors in textmessage

master
Eduardo Bart 12 years ago
parent 6293a49f8f
commit 09b4705a33

@ -1,4 +1,4 @@
MessageTypesConf = { MessageTypes = {
ConsoleRed = { color = '#F55E5E', consoleTab = tr('Default') }, ConsoleRed = { color = '#F55E5E', consoleTab = tr('Default') },
ConsoleOrange = { color = '#FE6500', consoleTab = tr('Default') }, ConsoleOrange = { color = '#FE6500', consoleTab = tr('Default') },
ConsoleBlue = { color = '#9F9DFD', consoleTab = tr('Default') }, ConsoleBlue = { color = '#9F9DFD', consoleTab = tr('Default') },
@ -43,9 +43,9 @@ function init()
export({ export({
clearMessages = clearMessages, clearMessages = clearMessages,
displayStatus = function() displayMessage(MessageTypes.StatusSmall, msg) end, displayStatus = function(msg, time) displayMessage('StatusSmall', msg) end,
displayEventAdvance = function() displayMessage(MessageTypes.EventAdvance, msg, time) end, displayEventAdvance = function(msg, time) displayMessage('EventAdvance', msg, time) end,
displayPrivate = function() displayPrivate(msg, time) end displayPrivate = function(msg, time) displayMessage('Private', time) end
}, 'TextMessage') }, 'TextMessage')
end end
@ -86,19 +86,19 @@ end
function displayMessage(msgtype, msg, time) function displayMessage(msgtype, msg, time)
if not g_game.isOnline() then return end if not g_game.isOnline() then return end
msgtypeconf = MessageTypesConf[msgtype] msgtype = MessageTypes[msgtype]
if msgtypeconf.consoleTab ~= nil then if msgtype.consoleTab ~= nil then
if msgtypeconf.consoleOption == nil or Options.getOption(msgtypeconf.consoleOption) then if msgtype.consoleOption == nil or Options.getOption(msgtype.consoleOption) then
Console.addText(msg, msgtypeconf, msgtypeconf.consoleTab) Console.addText(msg, msgtype, msgtype.consoleTab)
end end
end end
if msgtypeconf.labelId then if msgtype.labelId then
local label = GameInterface.getMapPanel():recursiveGetChildById(msgtypeconf.labelId) local label = GameInterface.getMapPanel():recursiveGetChildById(msgtype.labelId)
label:setText(msg) label:setText(msg)
label:setColor(msgtypeconf.color) label:setColor(msgtype.color)
if not time then if not time then
time = math.max(#msg * 100, 4000) time = math.max(#msg * 100, 4000)

Loading…
Cancel
Save