From f4ef9a16126cfcb0142e386b7a602662284dc26f Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 9 Jul 2021 22:11:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E5=9B=9E=E6=94=BE=E6=8E=A7=E5=88=B6=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=98=BE=E7=A4=BA=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/game.lua | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/parts/scenes/game.lua b/parts/scenes/game.lua index 03cec86c..95da060d 100644 --- a/parts/scenes/game.lua +++ b/parts/scenes/game.lua @@ -7,6 +7,7 @@ local noTouch,noKey=false,false local touchMoveLastFrame=false local floatRepRate,replayRate=0,1 +local replaying local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x",[5]="5x"} local function _rep0()replayRate=0 end local function _repP8()replayRate=.125 end @@ -23,12 +24,13 @@ function scene.sceneInit(org) resetGameData() GAME.init=false end + replaying=GAME.replaying if org~='pause'then floatRepRate,replayRate=0,1 end - noKey=GAME.replaying + noKey=replaying noTouch=not SETTING.VKSwitch or noKey - WIDGET.active.restart.hide=GAME.replaying + WIDGET.active.restart.hide=replaying end function scene.sceneBack() destroyPlayers() @@ -37,7 +39,7 @@ end scene.mouseDown=NULL local function restart() resetGameData(PLAYERS[1].frameRun<240 and'q') - noKey=GAME.replaying + noKey=replaying noTouch=noKey end function scene.touchDown(x,y) @@ -82,7 +84,7 @@ function scene.touchMove() end end function scene.keyDown(key,isRep) - if not GAME.replaying then + if not replaying then if isRep then return end local k=keyMap.keyboard[key] if k then @@ -174,7 +176,7 @@ local function update_common(dt) checkWarning() end function scene.update(dt) - local repPtr=GAME.replaying + local repPtr=replaying if repPtr then floatRepRate=floatRepRate+replayRate while floatRepRate>=1 do @@ -194,7 +196,7 @@ function scene.update(dt) end repPtr=repPtr+2 end - GAME.replaying=repPtr + replaying=repPtr end update_common(dt) end @@ -251,7 +253,7 @@ function scene.draw() gc.draw(drawableText.modeName,940,0) --Replaying - if GAME.replaying then + if replaying then setFont(20) gc.setColor(1,1,TIME()%.8>.4 and 1 or 0) mStr(text.replaying,770,6) @@ -264,13 +266,13 @@ function scene.draw() end scene.widgetList={ - WIDGET.newKey{name="rep0", fText=TEXTURE.rep.rep0,x=40,y=50,w=60,code=_rep0,hideF=function()return not GAME.replay and replayRate==0 end}, - WIDGET.newKey{name="repP8", fText=TEXTURE.rep.repP8,x=105,y=50,w=60,code=_repP8,hideF=function()return not GAME.replay and replayRate==.125 end}, - WIDGET.newKey{name="repP2", fText=TEXTURE.rep.repP2,x=170,y=50,w=60,code=_repP2,hideF=function()return not GAME.replay and replayRate==.5 end}, - WIDGET.newKey{name="rep1", fText=TEXTURE.rep.rep1,x=235,y=50,w=60,code=_rep1,hideF=function()return not GAME.replay and replayRate==1 end}, - WIDGET.newKey{name="rep2", fText=TEXTURE.rep.rep2,x=300,y=50,w=60,code=_rep2,hideF=function()return not GAME.replay and replayRate==2 end}, - WIDGET.newKey{name="rep5", fText=TEXTURE.rep.rep5,x=365,y=50,w=60,code=_rep5,hideF=function()return not GAME.replay and replayRate==5 end}, - WIDGET.newKey{name="step", fText=TEXTURE.rep.step,x=430,y=50,w=60,code=_step,hideF=function()return not GAME.replay and replayRate~=0 end}, + WIDGET.newKey{name="rep0", fText=TEXTURE.rep.rep0,x=40,y=50,w=60,code=_rep0,hideF=function()return not replaying or replayRate==0 end}, + WIDGET.newKey{name="repP8", fText=TEXTURE.rep.repP8,x=105,y=50,w=60,code=_repP8,hideF=function()return not replaying or replayRate==.125 end}, + WIDGET.newKey{name="repP2", fText=TEXTURE.rep.repP2,x=170,y=50,w=60,code=_repP2,hideF=function()return not replaying or replayRate==.5 end}, + WIDGET.newKey{name="rep1", fText=TEXTURE.rep.rep1,x=235,y=50,w=60,code=_rep1,hideF=function()return not replaying or replayRate==1 end}, + WIDGET.newKey{name="rep2", fText=TEXTURE.rep.rep2,x=300,y=50,w=60,code=_rep2,hideF=function()return not replaying or replayRate==2 end}, + WIDGET.newKey{name="rep5", fText=TEXTURE.rep.rep5,x=365,y=50,w=60,code=_rep5,hideF=function()return not replaying or replayRate==5 end}, + WIDGET.newKey{name="step", fText=TEXTURE.rep.step,x=430,y=50,w=60,code=_step,hideF=function()return not replaying or replayRate~=0 end}, WIDGET.newKey{name="restart", fText="R",x=380,y=35,w=60,font=40,code=restart}, WIDGET.newKey{name="pause", fText="II",x=900,y=35,w=60,font=40,code=function()pauseGame()end}, }