This commit is contained in:
Eduardo Bart 2013-02-26 18:13:50 -03:00
parent 41b81da76f
commit 406c7bdae6
2 changed files with 8 additions and 40 deletions

View File

@ -257,7 +257,6 @@ end
function clearChannel(consoleTabBar) function clearChannel(consoleTabBar)
consoleTabBar:getCurrentTab().tabPanel:getChildById('consoleBuffer'):destroyChildren() consoleTabBar:getCurrentTab().tabPanel:getChildById('consoleBuffer'):destroyChildren()
consoleTabBar:getCurrentTab().tabPanel:getChildById('consoleBufferHighlight'):destroyChildren()
end end
function setTextEditText(text) function setTextEditText(text)
@ -447,17 +446,16 @@ function addTabText(text, speaktype, tab, creatureName)
consoleTabBar:blinkTab(tab) consoleTabBar:blinkTab(tab)
-- Overlay for consoleBuffer which shows highlighted words only -- Overlay for consoleBuffer which shows highlighted words only
local consoleBufferHighlight = panel:getChildById('consoleBufferHighlight')
local labelHighlight = g_ui.createWidget('ConsolePhantomLabel', consoleBufferHighlight)
labelHighlight:setId('consoleLabel' .. consoleBufferHighlight:getChildCount()) if speaktype.npcChat and (g_game.getCharacterName() ~= creatureName or g_game.getCharacterName() == 'Account Manager') then
local highlightData = getHighlightedText(text)
if #highlightData > 0 then
local labelHighlight = g_ui.createWidget('ConsolePhantomLabel', label)
labelHighlight:fill('parent')
labelHighlight:setId('consoleLabelHighlight' .. consoleBuffer:getChildCount())
labelHighlight:setColor("#1f9ffe") labelHighlight:setColor("#1f9ffe")
if speaktype.npcChat and (g_game.getCharacterName() ~= creatureName or g_game.getCharacterName() == 'Account Manager') then -- Check if it is the npc who is talking
local highlightData = getHighlightedText(text)
if #highlightData == 0 then
labelHighlight:setText("")
else
-- Remove the curly braces -- Remove the curly braces
for i = 1, #highlightData / 3 do for i = 1, #highlightData / 3 do
local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] } local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] }
@ -496,8 +494,6 @@ function addTabText(text, speaktype, tab, creatureName)
labelHighlight:setText(tmpText) labelHighlight:setText(tmpText)
end end
else
labelHighlight:setText("")
end end
label.name = creatureName label.name = creatureName
@ -508,10 +504,6 @@ function addTabText(text, speaktype, tab, creatureName)
if consoleBuffer:getChildCount() > MAX_LINES then if consoleBuffer:getChildCount() > MAX_LINES then
consoleBuffer:getFirstChild():destroy() consoleBuffer:getFirstChild():destroy()
end end
if consoleBufferHighlight:getChildCount() > MAX_LINES then
consoleBufferHighlight:getFirstChild():destroy()
end
end end
function removeTabLabelByName(tab, name) function removeTabLabelByName(tab, name)

View File

@ -15,7 +15,6 @@ ConsolePhantomLabel < UILabel
font: verdana-11px-antialised font: verdana-11px-antialised
height: 14 height: 14
color: yellow color: yellow
margin-left: 2
text-wrap: true text-wrap: true
text-auto-resize: true text-auto-resize: true
selection-color: #111416 selection-color: #111416
@ -39,29 +38,6 @@ ConsoleTabBarPanel < MoveableTabBarPanel
inverted-scroll: true inverted-scroll: true
padding: 1 padding: 1
ScrollablePanel
id: consoleBufferHighlight
anchors.fill: parent
margin-right: 12
vertical-scrollbar: consoleScrollBarHighlight
layout:
type: verticalBox
align-bottom: true
inverted-scroll: true
padding: 1
@onScrollbarChange: |
local consoleScrollBar = self:getParent():getChildById('consoleScrollBar')
local consoleScrollBarHighlight = self:getParent():getChildById('consoleScrollBarHighlight')
consoleScrollBar:setValue(consoleScrollBarHighlight:getValue())
VerticalScrollBar
id: consoleScrollBarHighlight
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
step: 14
pixels-scroll: true
VerticalScrollBar VerticalScrollBar
id: consoleScrollBar id: consoleScrollBar
anchors.top: parent.top anchors.top: parent.top