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

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

View File

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