From 72524ab50f82fdf2e8e1204ab864ec8695a9f5d1 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 2 May 2021 02:20:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96textbox=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E8=A1=8C=E4=B8=BA=EF=BC=8C=E8=81=94=E7=BD=91=E5=AF=B9?= =?UTF-8?q?=E6=88=98=E6=97=B6=E8=83=BD=E6=98=BE=E7=A4=BA=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 9 +++++---- parts/scenes/net_game.lua | 13 ++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 2732cc2a..8734d4be 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -871,7 +871,7 @@ function textBox:update() end function textBox:push(t) ins(self.texts,t) - if self.scrollPos==#self.texts-1 then + if self.scrollPos==#self.texts-1 and not(self.hide==true or self.hide and self.hide())then self.scrollPos=#self.texts else self.new=true @@ -902,9 +902,6 @@ function textBox:scroll(n) self.scrollPos=max(self.scrollPos+n,min(#self.texts,self.capacity)) else self.scrollPos=min(self.scrollPos+n,#self.texts) - if self.scrollPos==#self.texts then - self.new=false - end end end function textBox:clear() @@ -918,6 +915,10 @@ function textBox:draw() local scroll=self.scrollPos local cap=self.capacity + --Update new message status, necessary when hide==true + if self.scrollPos==#self.texts then + self.new=false + end --Background gc.setColor(0,0,0,.3) diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index e0e60feb..c9b6e1f1 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -237,7 +237,7 @@ function scene.draw() drawFWM() --Players - for p=textBox.hide and 1 or 2,#PLAYERS do + for p=1,#PLAYERS do PLAYERS[p]:draw() end @@ -278,11 +278,12 @@ function scene.draw() --Profile drawSelfProfile() end + --New message - if textBox.new and textBox.hide then - setFont(30) - gc.setColor(1,TIME()%.4<.2 and 1 or 0,0) - gc.print("M",460,15) + if textBox.new then + setFont(40) + gc.setColor(1,.5+.5*math.sin(TIME()*26),0) + gc.print("M",430,10) end end scene.widgetList={ @@ -293,7 +294,6 @@ scene.widgetList={ return playing or NET.serverGaming or - not textBox.hide or PLY_NET[1].ready or NET.getlock('ready') end}, @@ -302,7 +302,6 @@ scene.widgetList={ return playing or NET.serverGaming or - not textBox.hide or not PLY_NET[1].ready or NET.getlock('ready') end},