From 2654c8a6140a2b912e504807bc09130a3e0f569b Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 17 Aug 2021 01:45:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96tas=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=9A=84=E4=BD=BF=E7=94=A8=E4=BD=93=E9=AA=8C=20=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E7=A6=81=E6=AD=A2=E5=BD=95=E5=83=8F=E4=B8=AD=E9=80=94?= =?UTF-8?q?=E8=BF=9B=E5=85=A5tas=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/game.lua | 42 +++++++++++++++++++++++------------------- parts/scenes/pause.lua | 23 ++++++++++++----------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/parts/scenes/game.lua b/parts/scenes/game.lua index 2c25c9fe..528a5d21 100644 --- a/parts/scenes/game.lua +++ b/parts/scenes/game.lua @@ -1,4 +1,4 @@ -local gc,kb,tc=love.graphics,love.keyboard,love.touch +local gc,tc=love.graphics,love.touch local sin=math.sin local SCR,VK=SCR,VK local GAME=GAME @@ -108,19 +108,20 @@ local function restart() noKey=replaying noTouch=replaying end -local function gameKeyDown(key) +local function checkGameKeyDown(key) local k=keyMap.keyboard[key] if k then if k>0 then if noKey then return end PLAYERS[1]:pressKey(k) VK.press(k) + return elseif not GAME.fromRepMenu then restart() + return end - elseif key=="escape"then - pauseGame() end + return true--No key pressed end function scene.sceneInit(org) @@ -210,23 +211,26 @@ function scene.keyDown(key,isRep) else if isRep then return - elseif tasMode then - if key=="f1"then - if not isRep then gameRate=gameRate==0 and .125 or 0 end - updateRepButtons() - elseif key=='f2'then - if not isRep then - speedDown() - end - elseif key=='f3'then - if gameRate==0 then - _step() - elseif not isRep then - speedUp() + elseif checkGameKeyDown(key)then + if tasMode then + if key=="f1"then + if not isRep then gameRate=gameRate==0 and .125 or 0 end + updateRepButtons() + elseif key=='f2'then + if not isRep then + speedDown() + end + elseif key=='f3'then + if gameRate==0 then + _step() + elseif not isRep then + speedUp() + end end end - else - gameKeyDown(key) + if key=="escape"then + pauseGame() + end end end end diff --git a/parts/scenes/pause.lua b/parts/scenes/pause.lua index 310c66c0..ba418768 100644 --- a/parts/scenes/pause.lua +++ b/parts/scenes/pause.lua @@ -162,7 +162,7 @@ function scene.keyDown(key,isRep) end timer2=0 elseif key=="t"then - if ALLOWTAS then + if ALLOWTAS and not(GAME.result or GAME.replaying)then GAME.tasUsed=true SFX.play('ren_mega') SFX.play('clear_3') @@ -220,6 +220,16 @@ function scene.draw() gc.pop() end + if GAME.tasUsed then + gc.push('transform') + gc.translate(560,205) + gc.scale(2.6) + setFont(100) + gc.setColor(.97,.97,.97,T*.08) + gc.print("TAS",50,-23,.3) + gc.pop() + end + --Big info frame if PLAYERS[1].frameRun>180 then gc.push('transform') @@ -236,15 +246,6 @@ function scene.draw() mStr(("%s:[%d] %.2fs"):format(text.pauseCount,GAME.pauseCount,GAME.pauseTime),305,389) end - if GAME.tasUsed then - gc.push('transform') - gc.scale(2.6) - setFont(100) - gc.setColor(.97,.97,.97,T*.08) - gc.print("TAS",50,-23,.3) - gc.pop() - end - --Pages if page==0 then --Frame @@ -357,7 +358,7 @@ scene.widgetList={ WIDGET.newKey{name="restart", x=290,y=340,w=300,h=70,code=pressKey"r",hideF=function()return GAME.fromRepMenu end}, WIDGET.newKey{name="setting", x=290,y=440,w=300,h=70,code=pressKey"s",hideF=function()return GAME.fromRepMenu end}, WIDGET.newKey{name="quit", x=290,y=540,w=300,h=70,code=backScene}, - WIDGET.newKey{name="tas", x=290,y=620,w=240,h=50,code=pressKey"t",hideF=function()return not ALLOWTAS or GAME.tasUsed end}, + WIDGET.newKey{name="tas", x=290,y=620,w=240,h=50,code=pressKey"t",hideF=function()return not ALLOWTAS or GAME.tasUsed or GAME.result or GAME.replaying end}, WIDGET.newKey{name="page_prev", x=500,y=390,w=70,code=pressKey"tab",noFrame=true, fText=GC.DO{70,70,{'setLW',2}, {'dRPol',33,35,32,3,6,3.142},{'dRPol',45,35,32,3,6,3.142}}, fShade=GC.DO{70,70,{'setCL',1,1,1,.6},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRPol',33,35,32,3,6,3.142},{'fRPol',45,35,32,3,6,3.142}}}},