联网推进(微调房间内交互,观战模式不再尝试发送录像流)

This commit is contained in:
MrZ626
2021-05-18 17:39:00 +08:00
parent cd49507a2b
commit d07075ca9c
4 changed files with 9 additions and 9 deletions

View File

@@ -476,7 +476,7 @@ function NET.updateWS_play()
NET.wsconn_stream() NET.wsconn_stream()
elseif res.action==9 then--Game finished elseif res.action==9 then--Game finished
NET.roomState.start=false NET.roomState.start=false
NET.watch=false NET.spectate=false
if SCN.socketRead then SCN.socketRead('finish',d)end if SCN.socketRead then SCN.socketRead('finish',d)end
NET.wsclose_stream() NET.wsclose_stream()
end end
@@ -522,7 +522,7 @@ function NET.updateWS_stream()
end end
end end
netPLY.setConnect(d.uid) netPLY.setConnect(d.uid)
NET.watch=d.watch==true NET.spectate=d.watch==true
else else
if d.watch then if d.watch then
netPLY.setWatch(d.uid) netPLY.setWatch(d.uid)

View File

@@ -1764,7 +1764,7 @@ function Player:lose(force)
end end
gameOver() gameOver()
self:newTask(#PLAYERS>1 and tick_lose or tick_finish) self:newTask(#PLAYERS>1 and tick_lose or tick_finish)
if GAME.net then if GAME.net and not NET.spectate then
NET.signal_die() NET.signal_die()
else else
TASK.new(tick_autoPause) TASK.new(tick_autoPause)

View File

@@ -47,7 +47,8 @@ end
scene.mouseDown=NULL 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 or noTouch then return end if not playing then netPLY.mouseMove(x,y)return end
if noTouch then return end
local t=VK.on(x,y) local t=VK.on(x,y)
if t then if t then
@@ -63,9 +64,8 @@ function scene.touchUp(x,y)
VK.release(n) VK.release(n)
end end
end end
function scene.touchMove(x,y) function scene.touchMove()
if not playing then netPLY.mouseMove(x,y)return end if touchMoveLastFrame or not playing or noTouch then return end
if touchMoveLastFrame or noTouch then return end
touchMoveLastFrame=true touchMoveLastFrame=true
local L=tc.getTouches() local L=tc.getTouches()
@@ -237,7 +237,7 @@ function scene.update(dt)
checkWarning() checkWarning()
--Upload stream --Upload stream
if P1.frameRun-lastUpstreamTime>8 then if not NET.spectate and P1.frameRun-lastUpstreamTime>8 then
local stream local stream
if not GAME.rep[upstreamProgress]then if not GAME.rep[upstreamProgress]then
ins(GAME.rep,P1.frameRun) ins(GAME.rep,P1.frameRun)

View File

@@ -29,7 +29,7 @@ local scene={}
function scene.sceneInit() function scene.sceneInit()
BG.set() BG.set()
NET.watch=false NET.spectate=false
NET.allReady=false NET.allReady=false
NET.connectingStream=false NET.connectingStream=false
NET.waitingStream=false NET.waitingStream=false