From 554e63925dfbeebe82bc68563a1e82eb3c1be32b Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 13 May 2021 16:20:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=BC=80=E5=A7=8B=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=BC=9A=E8=A2=AB=E8=AE=B0=E5=BD=95=E5=B8=A6=E8=BF=9B?= =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/net.lua | 6 +++++- parts/scenes/net_game.lua | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/parts/net.lua b/parts/net.lua index cf76cda2..c9922094 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -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 diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 57c330fa..20adad8a 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -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()