修复触屏虚拟按键松开后按钮还亮着

This commit is contained in:
MrZ626
2021-04-24 01:04:36 +08:00
parent e49e4a05bc
commit 311dc3b644
2 changed files with 12 additions and 12 deletions

View File

@@ -40,9 +40,10 @@ end
function scene.touchUp(x,y) function scene.touchUp(x,y)
if noTouch then return end if noTouch then return end
local t=VK.on(x,y) local n=VK.on(x,y)
if t then if n then
PLAYERS[1]:releaseKey(t) PLAYERS[1]:releaseKey(n)
VK.release(n)
end end
end end
function scene.touchMove() function scene.touchMove()
@@ -63,6 +64,7 @@ function scene.touchMove()
end end
end end
PLAYERS[1]:releaseKey(n) PLAYERS[1]:releaseKey(n)
VK.release(n)
end end
::CONTINUE_nextKey:: ::CONTINUE_nextKey::
end end
@@ -73,9 +75,7 @@ function scene.keyDown(key)
if k>0 then if k>0 then
if noKey then return end if noKey then return end
PLAYERS[1]:pressKey(k) PLAYERS[1]:pressKey(k)
local vk=VK.keys[k] VK.press(k)
vk.isDown=true
vk.pressTime=10
else else
restart() restart()
end end

View File

@@ -44,9 +44,10 @@ end
function scene.touchUp(x,y) function scene.touchUp(x,y)
if noTouch or not playing then return end if noTouch or not playing then return end
local t=VK.on(x,y) local n=VK.on(x,y)
if t then if n then
PLAYERS[1]:releaseKey(t) PLAYERS[1]:releaseKey(n)
VK.release(n)
end end
end end
function scene.touchMove() function scene.touchMove()
@@ -67,6 +68,7 @@ function scene.touchMove()
end end
end end
PLAYERS[1]:releaseKey(n) PLAYERS[1]:releaseKey(n)
VK.release(n)
end end
::CONTINUE_nextKey:: ::CONTINUE_nextKey::
end end
@@ -86,9 +88,7 @@ function scene.keyDown(key)
local k=keyMap.keyboard[key] local k=keyMap.keyboard[key]
if k and k>0 then if k and k>0 then
PLAYERS[1]:pressKey(k) PLAYERS[1]:pressKey(k)
local vk=VK.keys[k] VK.press(k)
vk.isDown=true
vk.pressTime=10
end end
elseif key=="space"then elseif key=="space"then
NET.signal_ready(not PLY_NET[1].ready) NET.signal_ready(not PLY_NET[1].ready)