From d32ad3ad7e21db88f33d7e9bf690e6e9bf0a853e Mon Sep 17 00:00:00 2001 From: oc Date: Fri, 30 Nov 2018 00:44:33 +0800 Subject: [PATCH] drawTextBox --- libs/ui.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/ui.js b/libs/ui.js index b5155f7a..7df9c315 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -576,11 +576,10 @@ ui.prototype.drawTextBox = function(content, showAll) { } } - var defaultColor = core.arrayToRGBA(textAttribute.text); var offsetx = content_left, offsety = content_top; core.setFont('ui', font); - core.setFillStyle('ui', defaultColor); - var index = 0, currcolor = defaultColor, changed = false; + core.setFillStyle('ui', textColor); + var index = 0, currcolor = textColor, changed = false; var drawNext = function () { if (index >= content.length) return false; @@ -607,11 +606,11 @@ ui.prototype.drawTextBox = function(content, showAll) { if (content.charAt(index) == '[' && ((index2=content.indexOf(']', index))>=0)) { // 变色 var str = content.substring(index+1, index2); - if (str=="") currcolor = defaultColor; + if (str=="") currcolor = textColor; else currcolor = str; index = index2+1; } - else currcolor = defaultColor; + else currcolor = textColor; return drawNext(); } // 检查是不是自动换行