微调网战房间内ui,全员准备后会有可视化标记

This commit is contained in:
MrZ626
2021-04-25 15:03:20 +08:00
parent cb16482a61
commit 4f278925f4
2 changed files with 17 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ local WS,TIME=WS,TIME
local NET={
connected=false,
allow_online=false,
allReady=false,
serverGaming=false,
roomList={},
accessToken=false,
@@ -401,7 +402,7 @@ function NET.updateWS_play()
if PLY_NET[i].uid==d.uid then
PLY_NET[i].config=d.config
PLY_NET[i].p:setConf(d.config)
return
break
end
end
resetGameData("qn")
@@ -411,17 +412,18 @@ function NET.updateWS_play()
if p.uid==d.uid then
if p.ready~=d.ready then
p.ready=d.ready
if not d.ready then NET.allReady=false end
SFX.play("spin_0",.6)
if i==1 then
NET.unlock("ready")
elseif not PLY_NET[1].ready then
for j=2,#PLY_NET do
if not PLY_NET[j].ready then
break
elseif j==#PLY_NET then
SFX.play("blip_2",.5)
goto BREAK_notAllReady
end
end
SFX.play("blip_2",.5)
::BREAK_notAllReady::
end
end
break
@@ -429,10 +431,12 @@ function NET.updateWS_play()
end
elseif res.action==7 then--All Ready
SFX.play("reach",.6)
NET.allReady=true
elseif res.action==8 then--Set
NET.rsid=d.rid
NET.wsconn_stream()
elseif res.action==9 then--Game finished
NET.allReady=false
NET.wsclose_stream()
if SCN.socketRead then SCN.socketRead("Finish",d)end
end

View File

@@ -239,8 +239,8 @@ function scene.draw()
--Rectangle
gc.setColor(COLOR[p.ready and"G"or"white"])
gc.setLineWidth(3)
gc.rectangle("line",40,67+50*i,800,42)
gc.setLineWidth(2)
gc.rectangle("line",40,65+50*i,1000,46)
--UID
setFont(40)
@@ -255,6 +255,13 @@ function scene.draw()
gc.print(p.username,240,60+50*i)
end
--All-ready mark
if NET.allReady then
gc.setColor(0,1,.2,.8)
gc.setLineWidth(10)
gc.rectangle("line",610,25,60,60)
end
--Profile
drawSelfProfile()
end