12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- --[[
- Descripttion:房间管理
- version:
- Author: Neo,Huang
- Date: 2023-11-16 22:19:05
- LastEditors: Neo,Huang
- LastEditTime: 2023-11-16 23:19:50
- --]]
- local timer = require("timer")
- local baseService = require("baseService")
- local util_match = require("utils.util_match")
- local nodeMgr = require("nodeMgr")
- local timerDestroyRoom = nil
- local CMD = {}
- -- 关闭超时未开始战斗房间
- local function _destroy_room()
- local activeRoomIdList = util_match:get_active_room_id_list()
- if is_empty(activeRoomIdList) then
- return
- end
- for _, v in ipairs(activeRoomIdList) do
- local roomId = tonumber(v)
- -- 是否等待开始战斗结束
- if util_match:is_wait_battle_end(roomId) then
- -- 通知在线玩家 - 销毁房间
- nodeMgr.broadcast_proto_notify("on_room_destroy", {roomId = roomId})
- -- 删除房间信息
- util_match:destroy_room(roomId)
- end
- end
- end
- function CMD.onStart()
- timerDestroyRoom = timer.timeOut(1, _destroy_room)
- end
- function CMD.onStop()
- -- 取消定时器
- timerDestroyRoom.func = nil
- end
- baseService.start(CMD, ".srvMatch", true)
|