From dea2f6c8d7ed2051a6338a54ef24a5e422a82a62 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 2 Aug 2021 22:09:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=95=E5=83=8F=E5=9B=9E?= =?UTF-8?q?=E6=94=BE=E9=80=9F=E5=BA=A6=E5=92=8C=E6=8C=89=E9=92=AE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=88=B7=E6=96=B0=E9=97=AE=E9=A2=98=20close=20#159=20?= =?UTF-8?q?close=20#160?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/game.lua | 48 ++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/parts/scenes/game.lua b/parts/scenes/game.lua index ec0b728d..e3a17ad2 100644 --- a/parts/scenes/game.lua +++ b/parts/scenes/game.lua @@ -5,47 +5,65 @@ local GAME=GAME local noTouch,noKey=false,false local touchMoveLastFrame=false -local floatRepRate,replayRate=0,1 +local floatRepRate,replayRate local replaying local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x",[5]="5x"} local scene={} -local function showRepButtons() - for i=1,6 do scene.widgetList[i].hide=false end - scene.widgetList[7].hide=true +local function updateRepButtons() + local L=scene.widgetList + if replaying then + for i=1,6 do L[i].hide=false end L[7].hide=true + if replayRate==0 then + L[1].hide=true + L[7].hide=false + elseif replayRate==.125 then + L[2].hide=true + elseif replayRate==.5 then + L[3].hide=true + elseif replayRate==1 then + L[4].hide=true + elseif replayRate==2 then + L[5].hide=true + elseif replayRate==5 then + L[6].hide=true + end + else + for i=1,7 do L[i].hide=true end + end end local function _rep0() - showRepButtons() scene.widgetList[1].hide=true scene.widgetList[7].hide=false replayRate=0 + updateRepButtons() end local function _repP8() - showRepButtons() scene.widgetList[2].hide=true replayRate=.125 + updateRepButtons() end local function _repP2() - showRepButtons() scene.widgetList[3].hide=true replayRate=.5 + updateRepButtons() end local function _rep1() - showRepButtons() scene.widgetList[4].hide=true replayRate=1 + updateRepButtons() end local function _rep2() - showRepButtons() scene.widgetList[5].hide=true replayRate=2 + updateRepButtons() end local function _rep5() - showRepButtons() scene.widgetList[6].hide=true replayRate=5 + updateRepButtons() end local function _step()floatRepRate=floatRepRate+1 end @@ -54,15 +72,11 @@ function scene.sceneInit() if GAME.init then resetGameData() GAME.init=false - floatRepRate,replayRate=0,1 end + floatRepRate,replayRate=0,1 replaying=GAME.replaying - for i=1,6 do - scene.widgetList[i].hide=not replaying - end - scene.widgetList[4].hide=true - scene.widgetList[7].hide=true + updateRepButtons() noKey=replaying noTouch=not SETTING.VKSwitch or noKey @@ -146,6 +160,7 @@ function scene.keyDown(key,isRep) elseif replayRate==1 then replayRate=2 elseif replayRate==2 then replayRate=5 end + updateRepButtons() end elseif key=="left"then if replayRate~=0 and not isRep then @@ -154,6 +169,7 @@ function scene.keyDown(key,isRep) elseif replayRate==2 then replayRate=1 elseif replayRate==5 then replayRate=2 end + updateRepButtons() end elseif key=="escape"then pauseGame()