"远程玩家"进入可用测试阶段
This commit is contained in:
@@ -655,7 +655,7 @@ function pumpRecording(str,L)
|
|||||||
local list,curFrm
|
local list,curFrm
|
||||||
if L then
|
if L then
|
||||||
list=L
|
list=L
|
||||||
curFrm=L[#L-1]
|
curFrm=L[#L-1]or 0
|
||||||
else
|
else
|
||||||
list={}
|
list={}
|
||||||
curFrm=0
|
curFrm=0
|
||||||
|
|||||||
@@ -346,6 +346,9 @@ end
|
|||||||
function PLY.newRemotePlayer(id,mini)
|
function PLY.newRemotePlayer(id,mini)
|
||||||
local P=newEmptyPlayer(id,mini)
|
local P=newEmptyPlayer(id,mini)
|
||||||
P.type="remote"
|
P.type="remote"
|
||||||
|
P.update=PLY.update.remote_alive
|
||||||
|
P.stream={}
|
||||||
|
P.streamProgress=1
|
||||||
|
|
||||||
loadGameEnv(P)
|
loadGameEnv(P)
|
||||||
applyGameEnv(P)
|
applyGameEnv(P)
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ local function updateTasks(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local update={}
|
local function update_alive(P,dt)
|
||||||
function update.alive(P,dt)
|
|
||||||
if P.timing then
|
if P.timing then
|
||||||
local S=P.stat
|
local S=P.stat
|
||||||
S.time=S.time+dt
|
S.time=S.time+dt
|
||||||
@@ -327,6 +326,10 @@ function update.alive(P,dt)
|
|||||||
updateFXs(P,dt)
|
updateFXs(P,dt)
|
||||||
updateTasks(P)
|
updateTasks(P)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local update={
|
||||||
|
alive=update_alive,
|
||||||
|
}
|
||||||
function update.dead(P,dt)
|
function update.dead(P,dt)
|
||||||
if P.keyRec then
|
if P.keyRec then
|
||||||
local S=P.stat
|
local S=P.stat
|
||||||
@@ -355,4 +358,24 @@ function update.dead(P,dt)
|
|||||||
updateFXs(P,dt)
|
updateFXs(P,dt)
|
||||||
updateTasks(P)
|
updateTasks(P)
|
||||||
end
|
end
|
||||||
|
function update.remote_alive(P,dt)
|
||||||
|
::readNext::
|
||||||
|
local pos=P.streamProgress
|
||||||
|
local tar=P.stream[pos]
|
||||||
|
if tar then
|
||||||
|
if P.stat.frame==tar then
|
||||||
|
local key=P.stream[pos+1]
|
||||||
|
if key>0 then--Press key
|
||||||
|
P:pressKey(key)
|
||||||
|
elseif key<0 then--Release key
|
||||||
|
P:releaseKey(-key)
|
||||||
|
else--Receiving garbage
|
||||||
|
--TODO:
|
||||||
|
end
|
||||||
|
P.streamProgress=pos+2
|
||||||
|
goto readNext
|
||||||
|
end
|
||||||
|
update_alive(P,dt)
|
||||||
|
end
|
||||||
|
end
|
||||||
return update
|
return update
|
||||||
Reference in New Issue
Block a user