实现玩家全部准备的时候顶部文字提醒

This commit is contained in:
MrZ_26
2022-10-24 00:26:32 +08:00
parent 43b6ff7697
commit 23f43df737
3 changed files with 8 additions and 13 deletions

View File

@@ -24,7 +24,7 @@ local NET={
spectate=false,-- If player is spectating spectate=false,-- If player is spectating
seed=false, seed=false,
roomReadyState=false, roomAllReady=false,
onlineCount="_", onlineCount="_",
@@ -44,14 +44,14 @@ function NET.freshRoomState()
if NETPLY.list[j].readyMode=='Ready' then readyCount=readyCount+1 end if NETPLY.list[j].readyMode=='Ready' then readyCount=readyCount+1 end
end end
if playCount-readyCount==1 then if playCount>1 and playCount-readyCount==1 then
local p=NETPLY.map[USER.uid] local p=NETPLY.map[USER.uid]
if p.playMode=='Gamer' and p.readyMode~='Ready' then if p.playMode=='Gamer' and p.readyMode~='Ready' then
SFX.play('warn_2',.5) SFX.play('warn_2',.5)
end end
end end
NET.roomReadyState=playCount>0 and playCount==readyCount NET.roomAllReady=playCount>0 and playCount==readyCount
end end
--------------------------<NEW HTTP API> --------------------------<NEW HTTP API>
@@ -646,7 +646,8 @@ function NET.wsCallBack.room_leave(body)
end end
function NET.wsCallBack.room_fetch(body) function NET.wsCallBack.room_fetch(body)
TASK.unlock('fetchRoom') TASK.unlock('fetchRoom')
if body.data then SCN.scenes.net_rooms.widgetList.roomList:setList(body.data) end if not body.data then body.data={} end
SCN.scenes.net_rooms.widgetList.roomList:setList(body.data)
end end
function NET.wsCallBack.room_setPW() function NET.wsCallBack.room_setPW()
MES.new(text.roomPasswordChanged) MES.new(text.roomPasswordChanged)

View File

@@ -274,15 +274,9 @@ function scene.draw()
-- Ready & Set mark -- Ready & Set mark
setFont(50) setFont(50)
if NET.roomReadyState=='allReady' then if NET.roomAllReady then
gc_setColor(1,.85,.6,.9)
mStr(text.ready,640,15)
elseif NET.roomReadyState=='connecting' then
gc_setColor(.6,1,.9,.9)
mStr(text.connStream,640,15)
elseif NET.roomReadyState=='waitConn' then
gc_setColor(.6,.95,1,.9) gc_setColor(.6,.95,1,.9)
mStr(text.waitStream,640,15) mStr(text.ready,640,15)
end end
-- Room info. -- Room info.

View File

@@ -36,7 +36,7 @@ local roomList=WIDGET.newListBox{name='roomList',x=50,y=50,w=800,h=440,lineH=40,
if item.state=='Standby' then if item.state=='Standby' then
gc_setColor(COLOR.Z) gc_setColor(COLOR.Z)
elseif item.state=='Ready' then elseif item.state=='Ready' then
gc_setColor(COLOR.lG) gc_setColor(COLOR.lB)
elseif item.state=='Playing' then elseif item.state=='Playing' then
gc_setColor(COLOR.G) gc_setColor(COLOR.G)
end end