房间开始状态会被记录带进房间内显示

This commit is contained in:
MrZ626
2021-05-13 16:20:19 +08:00
parent 57701c6041
commit 554e63925d
2 changed files with 6 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ local NET={
private=false,
-- count=false,
capacity=false,
start=false,
},
allReady=false,
connectingStream=false,
@@ -224,6 +225,7 @@ function NET.enterRoom(room,password)
NET.roomInfo.type=room.type or"?"
NET.roomInfo.private=not not password
NET.roomInfo.capacity=room.capacity or"?"
NET.roomInfo.start=room.start
WS.send('play',JSON.encode{
action=2,
data={
@@ -450,6 +452,7 @@ function NET.updateWS_play()
elseif res.action==9 then--Game finished
NET.wsclose_stream()
if SCN.socketRead then SCN.socketRead('finish',d)end
NET.roomInfo.start=false
end
else
WS.alert('play')
@@ -479,7 +482,8 @@ function NET.updateWS_stream()
NET.unlock('wsc_stream')
elseif res.action==0 then--Game start
NET.connectingStream=false
SCN.socketRead('go',d)
if SCN.socketRead then SCN.socketRead('go',d)end
NET.roomInfo.start=true
elseif res.action==1 then--Game finished
--?
elseif res.action==2 then--Player join

View File

@@ -262,6 +262,7 @@ function scene.draw()
setFont(40)
gc.print(netPLY.getCount().."/"..NET.roomInfo.capacity,70,655)
if NET.roomInfo.private then gc.draw(IMG.lock,30,668)end
if NET.roomInfo.start then gc.setColor(0,1,0)gc.print(text.started,230,655)end
--Profile
drawSelfProfile()