注释后加空格

联网稍微推进
This commit is contained in:
MrZ_26
2022-10-03 02:43:51 +08:00
parent 06f4bb4e1a
commit f8d17b23b6
121 changed files with 1628 additions and 1622 deletions

View File

@@ -302,9 +302,7 @@ function NET.room.chat(mes,rid)
})
end
function NET.room.create(roomName,description,capacity,roomType,roomData,password)
if not TASK.lock('enterRoom',2) then return end
NET.roomState.private=not not password
NET.roomState.capacity=capacity
if not TASK.lock('enterRoom',6) then return end
wsSend(1301,{
capacity=capacity,
info={
@@ -314,9 +312,14 @@ function NET.room.create(roomName,description,capacity,roomType,roomData,passwor
description=description,
},
data=roomData,
password=password,
})
WAIT{
quit=function()
TASK.unlock('enterRoom')
end,
timeout=1e99,
}
end
function NET.room.getData(rid)
wsSend(1302,{
@@ -341,7 +344,7 @@ function NET.room.setInfo(info,rid)
})
end
function NET.room.enter(rid,password)
if TASK.lock('enterRoom',6) then
if not TASK.lock('enterRoom',6) then return end
SFX.play('reach',.6)
wsSend(1306,{
data={
@@ -350,7 +353,6 @@ function NET.room.enter(rid,password)
}
})
end
end
function NET.room.kick(pid,rid)
wsSend(1307,{
playerId=pid,-- Host
@@ -361,7 +363,7 @@ function NET.room.leave()
wsSend(1308)
end
function NET.room.fetch()
if TASK.lock('fetchRoom',3) then
if not TASK.lock('fetchRoom',3) then return end
wsSend(1309,{
data={
pageIndex=0,
@@ -369,9 +371,8 @@ function NET.room.fetch()
}
})
end
end
function NET.room.setPW(pw,rid)
if TASK.lock('fetchRoom',3) then
if not TASK.lock('setRoomPW',2) then return end
wsSend(1310,{
data={
password=pw,
@@ -379,7 +380,6 @@ function NET.room.setPW(pw,rid)
}
})
end
end
function NET.room.remove(rid)
wsSend(1311,{
roomId=rid-- Admin
@@ -450,26 +450,34 @@ function NET.updateWS()
elseif res.action==1100 then-- TODO
elseif res.action==1101 then-- TODO
elseif res.action==1102 then-- TODO
elseif res.action==1201 then-- TODO
elseif res.action==1202 then-- TODO
elseif res.action==1203 then-- TODO
elseif res.action==1204 then-- TODO
elseif res.action==1205 then-- TODO
elseif res.action==1206 then-- TODO
elseif res.action==1207 then-- TODO
elseif res.action==1301 then-- TODO
elseif res.action==1302 then-- TODO
elseif res.action==1303 then-- TODO
elseif res.action==1304 then-- TODO
elseif res.action==1305 then-- TODO
elseif res.action==1306 then-- TODO
elseif res.action==1307 then-- TODO
elseif res.action==1308 then-- TODO
elseif res.action==1201 then-- Finish
elseif res.action==1202 then-- Join group
elseif res.action==1203 then-- Set ready
elseif res.action==1204 then-- Set host
elseif res.action==1205 then-- Set state
elseif res.action==1206 then-- Stream
elseif res.action==1207 then-- Set playing
elseif res.action==1301 then-- Create room
TASK.unlock('enterRoom')
-- NET.roomState=...
-- SCN.go('net_game')
WAIT.interrupt()
elseif res.action==1302 then-- Get room data
elseif res.action==1303 then-- Set room data
elseif res.action==1304 then-- Get room info
elseif res.action==1305 then-- Set room info
elseif res.action==1306 then-- Enter room
TASK.unlock('enterRoom')
-- NET.roomState=...
-- SCN.go('net_game')
WAIT.interrupt()
elseif res.action==1307 then-- Kick room
elseif res.action==1308 then-- Leave room
elseif res.action==1309 then-- Fetch rooms
TASK.unlock('fetchRoom')
if res.data then SCN.scenes.net_rooms.widgetList.roomList:setList(res.data) end
elseif res.action==1310 then-- TODO
elseif res.action==1311 then-- TODO
elseif res.action==1310 then-- Set password
elseif res.action==1311 then-- Remove room
end
else
WS.alert('user')
@@ -492,7 +500,7 @@ end
-- Save
function NET.uploadSave()
if TASK.lock('uploadSave',8) then
if not TASK.lock('uploadSave',8) then return end
wsSend({data={sections={
{section=1,data=STRING.packTable(STAT)},
{section=2,data=STRING.packTable(RANKS)},
@@ -504,13 +512,11 @@ function NET.uploadSave()
}}})
MES.new('info',"Uploading")
end
end
function NET.downloadSave()
if TASK.lock('downloadSave',8) then
if not TASK.lock('downloadSave',8) then return end
wsSend({data={sections={1,2,3,4,5,6,7}}})
MES.new('info',"Downloading")
end
end
function NET.loadSavedData(sections)
for _,sec in next,sections do
if sec.section==1 then