Appearance
云服模块管理接口 CloudSever
具体函数名及描述如下:
序号 | 函数名 | 函数描述 |
---|---|---|
1 | SetDataListBykey(...) | 设置表中指定键的值 |
2 | GetDataListByKey(...) | 获取表中指定键的值 |
3 | TransmitToCategoryRoom(...) | 传送玩家到指定分类房间 |
4 | TransmitToCurMapCategoryRoom(...) | 传送当前地图指定分类的云服房间 |
5 | GetRoomCategory(...) | 获取当前房间的分类信息(仅云服生效,和传送到指定分类房间接口配合使用) |
6 | SetRoomCategory(...) | 设置当前房间分类类型(有调用的冷却时间) |
SetDataListBykey
- 参数及类型:
- 返回值及类型:
- ret:
boolean
成功(true)
- ret:
- 该方法的主要作用: 设置表中指定键的值
- 具体使用案例如下:
lua
local result = CloudSever:SetDataListBykey("datalist_1744283491", "num", 123)
GetDataListByKey
- 参数及类型:
- 返回值及类型:
- ret:
boolean
成功(true)
- ret:
- 该方法的主要作用: 获取表中指定键的值
- 具体使用案例如下:
lua
CloudSever:GetDataListByKey("datalist_1744283491", "num", function (code, key, data)
-- 成功
if code == 0 then
value = data
isSuccess = true
print("获取成功")
elseif code == 1 then
isSuccess = false
print("获取失败")
elseif code == 2 then
isSuccess = false
print("数据不存在")
end
end)
TransmitToCategoryRoom
- 参数及类型:
- 返回值及类型:
- ret:
boolean
成功(true)
- ret:
- 该方法的主要作用: 传送玩家到指定分类房间
- 具体使用案例如下:
lua
local ret = CloudSever:TransmitToCategoryRoom(playerids, mapid, categorys, teleportmsg, notFollow)
TransmitToCurMapCategoryRoom
- 参数及类型:
- playerid:uin玩家UIN或玩家uin的数组
- category:
string
分类ID(数值和字符串组合)
- 返回值及类型:
- ret:
boolean
成功(true)
- ret:
- 该方法的主要作用: 传送当前地图指定分类的云服房间
- 具体使用案例如下:
lua
local ret = CloudSever:TransmitToCurMapCategoryRoom(playerids, categorys)
GetRoomCategory
- 参数及类型: 无
- 返回值及类型:
- msg:
string
分类信息
- msg:
- 该方法的主要作用: 获取当前房间的分类信息(仅云服生效,和传送到指定分类房间接口配合使用)
- 具体使用案例如下:
lua
local msg = CloudSever:GetRoomCategory()
SetRoomCategory
lua
local ret = CloudSever:SetRoomCategory(category)