修复文本框控件有新消息时颜色错误
This commit is contained in:
@@ -832,7 +832,7 @@ end
|
|||||||
function textBox:push(t)
|
function textBox:push(t)
|
||||||
ins(self.texts,t)
|
ins(self.texts,t)
|
||||||
if self.scrollPos==#self.texts-1 then
|
if self.scrollPos==#self.texts-1 then
|
||||||
self.scrollPos=self.scrollPos+1
|
self.scrollPos=#self.texts
|
||||||
else
|
else
|
||||||
SFX.play("spin_0",.8)
|
SFX.play("spin_0",.8)
|
||||||
self.new=true
|
self.new=true
|
||||||
@@ -896,24 +896,25 @@ function textBox:draw()
|
|||||||
gc.rectangle("fill",x-22,y+(h-len-6)*(scroll-cap)/(#texts-cap)+3,14,len)
|
gc.rectangle("fill",x-22,y+(h-len-6)*(scroll-cap)/(#texts-cap)+3,14,len)
|
||||||
end
|
end
|
||||||
|
|
||||||
setFont(30)
|
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
|
setFont(30)
|
||||||
--Clear button
|
--Clear button
|
||||||
if not self.fix then
|
if not self.fix then
|
||||||
mStr(self.sure>0 and"?"or"X",x+w-20,y-1)
|
mStr(self.sure>0 and"?"or"X",x+w-20,y-1)
|
||||||
gc.rectangle("line",x+w-40,y,40,40)
|
gc.rectangle("line",x+w-40,y,40,40)
|
||||||
end
|
end
|
||||||
--New message
|
|
||||||
if self.new and self.scrollPos~=#texts then
|
|
||||||
gc.setColor(1,TIME()%.4<.2 and 1 or 0,0)
|
|
||||||
gc.print("v",x+w-25,y+h-40)
|
|
||||||
end
|
|
||||||
|
|
||||||
--Texts
|
--Texts
|
||||||
setFont(self.font)
|
setFont(self.font)
|
||||||
for i=max(scroll-cap+1,1),scroll do
|
for i=max(scroll-cap+1,1),scroll do
|
||||||
gc.printf(texts[i],x+8,y+h-10-self.lineH*(scroll-i+1),w)
|
gc.printf(texts[i],x+8,y+h-10-self.lineH*(scroll-i+1),w)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--New message
|
||||||
|
if self.new and self.scrollPos~=#texts then
|
||||||
|
gc.setColor(1,TIME()%.4<.2 and 1 or 0,0)
|
||||||
|
gc.print("v",x+w-25,y+h-40)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function textBox:getInfo()
|
function textBox:getInfo()
|
||||||
return format("x=%d,y=%d,w=%d,h=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
|
return format("x=%d,y=%d,w=%d,h=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
|
||||||
|
|||||||
Reference in New Issue
Block a user