From 83f037b704dec11779e259566ddbf65fcb279e50 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 8 Jun 2021 06:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=EF=BC=8Cte?= =?UTF-8?q?st=E5=9C=BA=E6=99=AF=E5=8F=AF=E4=BB=A5=E9=80=80=E5=87=BA?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 1 - parts/scenes/game.lua | 4 ++++ parts/scenes/mode.lua | 1 - parts/scenes/net_game.lua | 1 - parts/scenes/test.lua | 12 +++++++++++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index f0c72708..05290242 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -524,7 +524,6 @@ function love.run() local TEXTURE,TIME=TEXTURE,TIME local SETTING,VERSION=SETTING,VERSION - local destroyPlayers=destroyPlayers local STEP,WAIT=love.timer.step,love.timer.sleep local FPS,MINI=love.timer.getFPS,love.window.isMinimized diff --git a/parts/scenes/game.lua b/parts/scenes/game.lua index 6b8c465b..a1527d44 100644 --- a/parts/scenes/game.lua +++ b/parts/scenes/game.lua @@ -16,6 +16,10 @@ function scene.sceneInit() noKey=GAME.replaying noTouch=not SETTING.VKSwitch or noKey end +function scene.sceneBack() + love.keyboard.setKeyRepeat(true) + destroyPlayers() +end scene.mouseDown=NULL local function restart() diff --git a/parts/scenes/mode.lua b/parts/scenes/mode.lua index 461fef97..9a60584e 100644 --- a/parts/scenes/mode.lua +++ b/parts/scenes/mode.lua @@ -29,7 +29,6 @@ local scene={} function scene.sceneInit(org) BG.set() - destroyPlayers() mapCam.zoomK=org=='main'and 5 or 1 end diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 357a6c8d..db664eb9 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -219,7 +219,6 @@ function scene.socketRead(cmd,d) end elseif cmd=='finish'then playing=false - love.keyboard.setKeyRepeat(true) end end diff --git a/parts/scenes/test.lua b/parts/scenes/test.lua index 949d3447..37393fb7 100644 --- a/parts/scenes/test.lua +++ b/parts/scenes/test.lua @@ -3,6 +3,7 @@ local ins,rem=table.insert,table.remove local scene={} +local backCounter local list,timer local function push(mes) ins(list,{mes,120}) @@ -10,13 +11,14 @@ local function push(mes) end function scene.sceneInit() + backCounter=5 list={} timer=0 love.keyboard.setKeyRepeat(false) end function scene.sceneBack() - list=nil + list={} love.keyboard.setKeyRepeat(true) end @@ -28,6 +30,14 @@ function scene.gamepadUp(key) end function scene.keyDown(key) push("[keyDown] <"..key..">") + if key=="escape"then + backCounter=backCounter-1 + if backCounter==0 then + SCN.back() + else + LOG.print(backCounter) + end + end end function scene.keyUp(key) push{COLOR.H,"[keyUp] <"..key..">"}