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