修改观战状态检测
整理代码
This commit is contained in:
@@ -90,7 +90,7 @@ scene.mouseDown=NULL
|
|||||||
function scene.mouseMove(x,y) NETPLY.mouseMove(x,y) end
|
function scene.mouseMove(x,y) NETPLY.mouseMove(x,y) end
|
||||||
function scene.touchDown(x,y)
|
function scene.touchDown(x,y)
|
||||||
if not playing then NETPLY.mouseMove(x,y) return end
|
if not playing then NETPLY.mouseMove(x,y) return end
|
||||||
if noTouch then return end
|
if NET.spectate or noTouch then return end
|
||||||
|
|
||||||
local t=VK.on(x,y)
|
local t=VK.on(x,y)
|
||||||
if t then
|
if t then
|
||||||
@@ -99,7 +99,7 @@ function scene.touchDown(x,y)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.touchUp(x,y)
|
function scene.touchUp(x,y)
|
||||||
if not playing or noTouch then return end
|
if not playing or NET.spectate or noTouch then return end
|
||||||
local n=VK.on(x,y)
|
local n=VK.on(x,y)
|
||||||
if n then
|
if n then
|
||||||
PLAYERS[1]:releaseKey(n)
|
PLAYERS[1]:releaseKey(n)
|
||||||
@@ -149,7 +149,7 @@ function scene.keyDown(key,isRep)
|
|||||||
WIDGET.focus(inputBox)
|
WIDGET.focus(inputBox)
|
||||||
inputBox:keypress(key)
|
inputBox:keypress(key)
|
||||||
elseif playing then
|
elseif playing then
|
||||||
if noKey or isRep then return end
|
if NET.spectate or noKey or isRep then return end
|
||||||
local k=KEY_MAP.keyboard[key]
|
local k=KEY_MAP.keyboard[key]
|
||||||
if k and k>0 then
|
if k and k>0 then
|
||||||
PLAYERS[1]:pressKey(k)
|
PLAYERS[1]:pressKey(k)
|
||||||
@@ -168,7 +168,7 @@ function scene.keyDown(key,isRep)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyUp(key)
|
function scene.keyUp(key)
|
||||||
if not playing or noKey then return end
|
if not playing or NET.spectate or noKey then return end
|
||||||
local k=KEY_MAP.keyboard[key]
|
local k=KEY_MAP.keyboard[key]
|
||||||
if k and k>0 then
|
if k and k>0 then
|
||||||
PLAYERS[1]:releaseKey(k)
|
PLAYERS[1]:releaseKey(k)
|
||||||
@@ -253,8 +253,7 @@ function scene.update(dt)
|
|||||||
for i=1,#NETPLY.list do
|
for i=1,#NETPLY.list do
|
||||||
NETPLY.list[i].readyMode='Playing'
|
NETPLY.list[i].readyMode='Playing'
|
||||||
end
|
end
|
||||||
noKey=PLAYERS[1].uid~=USER.uid
|
NET.spectate=PLAYERS[1].uid~=USER.uid
|
||||||
noTouch=noKey
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user