限制客户端一般只能开单挑房,电脑用户可以开多人房,特殊电脑用户可以开更大的房

This commit is contained in:
MrZ626
2021-04-10 02:48:51 +08:00
parent 3015db94be
commit 315237d0fc
2 changed files with 14 additions and 4 deletions

View File

@@ -173,13 +173,13 @@ function NET.fetchRoom()
})
end
end
function NET.createRoom()
function NET.createRoom(roomType,name)
if NET.lock("enterRoom",3)then
WS.send("play",JSON.encode{
action=1,
data={
type="classic",
name=(USER.username or"???").."'s room",
type=roomType,
name=name,
password=nil,
config=dumpBasicConfig(),
}

View File

@@ -1,4 +1,5 @@
local gc=love.graphics
local kb=love.keyboard
local NET=NET
local scrollPos,selected
@@ -29,7 +30,16 @@ function scene.keyDown(k)
end
elseif k=="n"then
if TIME()-lastCreateRoomTime>16.2 then
NET.createRoom()
NET.createRoom(
kb.isDown("1")and"solo"or
kb.isDown("2")and"classic"or
tonumber(USER.uid)<100 and(
kb.isDown("3")and"r49"or
kb.isDown("4")and"r99"or
kb.isDown("5")and"unlimited"
)or"solo'",
(USER.username or"???").."'s room"
)
lastCreateRoomTime=TIME()
else
LOG.print(text.createRoomTooFast,"warn")