From cc033afa931ee257b84fe85d8eac65f34121cab7 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Sun, 22 Dec 2024 10:08:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=86=E6=9E=B6=E8=B7=9F=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zenitha | 2 +- .../mechanicLib/brik/allclearGenerator.lua | 8 +-- assets/game/mechanicLib/brik/attackSys.lua | 8 +-- main.lua | 51 +++++++++++++++---- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/Zenitha b/Zenitha index 4768f9ba..2ad3ab71 160000 --- a/Zenitha +++ b/Zenitha @@ -1 +1 @@ -Subproject commit 4768f9bac4ccb3a242cb85b79cbed3beb54b26db +Subproject commit 2ad3ab715fc6bd5c031f820108ea5a2fea16c88a diff --git a/assets/game/mechanicLib/brik/allclearGenerator.lua b/assets/game/mechanicLib/brik/allclearGenerator.lua index a23f9cbe..668db08d 100644 --- a/assets/game/mechanicLib/brik/allclearGenerator.lua +++ b/assets/game/mechanicLib/brik/allclearGenerator.lua @@ -165,14 +165,14 @@ local function filterTop(field,pieces) end end local function printField(f) - print("--------------------------") + local s=STRING.newBuf() + s:put("--------------------------") for y=#f,1,-1 do - local s="" for x=1,#f[y] do - s=s..(f[y][x] and 'X' or '.') + s:put(f[y][x] and "X" or ".") end - print(s) end + print(s) end local function printSeq(s) s=TABLE.copy(s,0) diff --git a/assets/game/mechanicLib/brik/attackSys.lua b/assets/game/mechanicLib/brik/attackSys.lua index 4c0e1d02..2b2691e3 100644 --- a/assets/game/mechanicLib/brik/attackSys.lua +++ b/assets/game/mechanicLib/brik/attackSys.lua @@ -103,22 +103,22 @@ modern={ end do -- Text & Sound - local t="" + local t=STRING.newBuf() -- Add CHG text & sound if newCharge>oldCharge then if newCharge>1 then - t=t..Text.charge.." " + t:put(Text.charge.." ") P:playSound('charge',newCharge) end elseif oldCharge-newCharge>=2 then - t=t..Text.charge.." " + t:put(Text.charge.." ") P:playSound('discharge') end -- Add spin text & sound if tspin then - t=t..Text.spin:repD(M.brik.name).." " + t:put(Text.spin:repD(M.brik.name).." ") P:playSound('spin',lines) end diff --git a/main.lua b/main.lua index 35104b52..0d4ab546 100644 --- a/main.lua +++ b/main.lua @@ -221,14 +221,21 @@ FONT.load{ FONT.setDefaultFallback('symbols') FONT.setDefaultFont('norm') SCR.setSize(1600,1000) -local bFill=WIDGET.newClass('button_fill','button') do +do -- WIDGET.newClass + local bFill=WIDGET.newClass('button_fill','button') + local bInvis=WIDGET.newClass('button_invis','button') + local gc=love.graphics + local gc_push,gc_pop=gc.push,gc.pop + local gc_translate,gc_scale=gc.translate,gc.scale + local gc_setColor=gc.setColor + local alignDraw=WIDGET._alignDraw function bFill:draw() - gc.push('transform') - gc.translate(self._x,self._y) + gc_push('transform') + gc_translate(self._x,self._y) if self._pressTime>0 then - gc.scale(1-self._pressTime/self._pressTimeMax*.0626) + gc_scale(1-self._pressTime/self._pressTimeMax*.0626) end local w,h=self.w,self.h @@ -238,19 +245,43 @@ local bFill=WIDGET.newClass('button_fill','button') do local r,g,b=c[1],c[2],c[3] -- Rectangle - gc.setColor(.15+r*.7*(1-HOV*.26),.15+g*.7*(1-HOV*.26),.15+b*.7*(1-HOV*.26),.9) + gc_setColor(.15+r*.7*(1-HOV*.26),.15+g*.7*(1-HOV*.26),.15+b*.7*(1-HOV*.26),.9) + GC.mRect('fill',0,0,w,h,self.cornerR) + + -- Drawable + if self._image then + gc_setColor(1,1,1) + alignDraw(self,self._image) + end + if self._text then + gc_setColor(self.textColor) + alignDraw(self,self._text) + end + gc_pop() + end + function bInvis:draw() + gc_push('transform') + gc_translate(self._x,self._y) + + local w,h=self.w,self.h + local HOV=self._hoverTime/self._hoverTimeMax + + local fillC=self.fillColor + + -- Rectangle + gc_setColor(fillC[1],fillC[2],fillC[3],HOV*.16) GC.mRect('fill',0,0,w,h,self.cornerR) -- Drawable if self._image then - gc.setColor(1,1,1) - WIDGET._alignDraw(self,self._image) + gc_setColor(1,1,1) + alignDraw(self,self._image) end if self._text then - gc.setColor(self.textColor) - WIDGET._alignDraw(self,self._text) + gc_setColor(self.textColor) + alignDraw(self,self._text) end - gc.pop() + gc_pop() end end WIDGET.setDefaultOption{