From 8421d2e03ca9375d73f2efe0c3cce658febc30f8 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 17 Feb 2021 01:49:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B2=A1=E5=BC=80=E6=BF=92?= =?UTF-8?q?=E6=AD=BB=E7=89=B9=E6=95=88=E6=97=B6=E6=BF=92=E6=AD=BB=E9=9F=B3?= =?UTF-8?q?=E6=95=88=E4=B9=9F=E6=B2=A1=E6=9C=89=EF=BC=8C=E6=95=B4=E7=90=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E5=A4=8D=E5=87=A0=E4=B8=AA=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E9=87=8D=E6=9E=84=E5=AF=BC=E8=87=B4=E7=9A=84=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E6=B3=84=E9=9C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/gametoolfunc.lua | 34 +++++++++++++++++++++++++--------- parts/scenes/net_game.lua | 10 +--------- parts/scenes/play.lua | 10 +--------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index cf73d829..a9d47cd1 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -3,8 +3,9 @@ local data=love.data local fs=love.filesystem local gc=love.graphics -local gc_setColor,gc_circle=gc.setColor,gc.circle - +local gc_setColor,gc_setLineWidth,gc_setShader=gc.setColor,gc.setLineWidth,gc.setShader +local gc_push,gc_pop,gc_origin=gc.push,gc.pop,gc.origin +local gc_draw,gc_rectangle,gc_circle=gc.draw,gc.rectangle,gc.circle local max,int,rnd=math.max,math.floor,math.random local sub=string.sub local char,byte=string.char,string.byte @@ -361,7 +362,7 @@ end ---Game draw +--Virtualkey local VK=virtualkey function drawVirtualkeys() if SETTING.VKSwitch then @@ -373,11 +374,11 @@ function drawVirtualkeys() if VK[i].ava then local B=VK[i] gc_setColor(1,1,1,a) - gc.setLineWidth(B.r*.07) + gc_setLineWidth(B.r*.07) gc_circle("line",B.x,B.y,B.r,10)--Button outline _=VK[i].pressTime gc_setColor(B.color[1],B.color[2],B.color[3],a) - gc.draw(icons[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18)--Icon + gc_draw(icons[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18)--Icon if _>0 then gc_setColor(1,1,1,a*_*.08) gc_circle("fill",B.x,B.y,B.r*.94,10)--Glow when press @@ -390,7 +391,7 @@ function drawVirtualkeys() if VK[i].ava then local B=VK[i] gc_setColor(1,1,1,a) - gc.setLineWidth(B.r*.07) + gc_setLineWidth(B.r*.07) gc_circle("line",B.x,B.y,B.r,10) _=VK[i].pressTime if _>0 then @@ -446,7 +447,7 @@ end function updateVirtualkey() if SETTING.VKSwitch then for i=1,#VK do - _=VK[i] + local _=VK[i] if _.pressTime>0 then _.pressTime=_.pressTime-1 end @@ -795,7 +796,7 @@ end function checkWarning() local P1=PLAYERS[1] if P1.alive then - if GAME.frame%26==0 and SETTING.warn then + if GAME.frame%26==0 then local F=P1.field local height=0--Max height of row 4~7 for x=4,7 do @@ -810,7 +811,7 @@ function checkWarning() end GAME.warnLVL0=math.log(height-15+P1.atkBuffer.sum*.8) end - _=GAME.warnLVL + local _=GAME.warnLVL if _0 then @@ -969,6 +970,21 @@ end +--Game draw +function drawWarning() + if SETTING.warn and GAME.warnLVL>0 then + gc_push("transform") + gc_origin() + SHADER.warning:send("level",GAME.warnLVL) + gc_setShader(SHADER.warning) + gc_rectangle("fill",0,0,SCR.w,SCR.h) + gc_setShader() + gc_pop() + end +end + + + --Widget function shortcuts function backScene()SCN.back()end do--function goScene(name,style) diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index b6ffbfa2..1c5da0a4 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -312,15 +312,7 @@ function scene.draw() drawVirtualkeys() --Warning - gc.push("transform") - gc.origin() - if GAME.warnLVL>0 then - SHADER.warning:send("level",GAME.warnLVL) - gc.setShader(SHADER.warning) - gc.rectangle("fill",0,0,SCR.w,SCR.h) - gc.setShader() - end - gc.pop() + drawWarning() --New message if textBox.new and hideChatBox then diff --git a/parts/scenes/play.lua b/parts/scenes/play.lua index d942fe9f..5fe83389 100644 --- a/parts/scenes/play.lua +++ b/parts/scenes/play.lua @@ -226,15 +226,7 @@ function scene.draw() end --Warning - gc.push("transform") - gc.origin() - if GAME.warnLVL>0 then - SHADER.warning:send("level",GAME.warnLVL) - gc.setShader(SHADER.warning) - gc.rectangle("fill",0,0,SCR.w,SCR.h) - gc.setShader() - end - gc.pop() + drawWarning() end scene.widgetList={ WIDGET.newKey{name="restart",fText="R",x=380,y=35,w=60,font=40,code=restart},