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

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

View File

@@ -1764,7 +1764,7 @@ function Player:lose(force)
end
gameOver()
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()
else
TASK.new(tick_autoPause)

View File

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

View File

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