/// <summary>
        /// 队伍进入匹配队列
        /// 保证是队长发起 保证队伍人数大于0人
        /// </summary>
        public void OnJoinMatchQueue(ulong teamId, string playerId, int barrierId)
        {
            S2CM_JoinMatchQueueComplete message = new S2CM_JoinMatchQueueComplete();

            message.State = S2CM_JoinMatchQueueComplete.Types.State.Fail;
            //1 验证 队伍是否存在
            MatchTeam matchTeam = null;
            GameMatchPlayerContextQueue gameMatchPlayerContextQueue = null;

            if (!m_teamDic.TryGetValue(teamId, out matchTeam))
            {
                goto Result;
            }
            //2 验证队长是否合法
            if (matchTeam.GetCaptainId() != playerId)
            {
                goto Result;
            }
            //3 验证team状态是否满足
            if (matchTeam.State != MatchTeam.MatchTeamState.OPEN)
            {
                goto Result;
            }
            //4 验证是否有对应的关卡匹配队列

            if (!m_gameMatchPlayerCtxQueDic.TryGetValue(barrierId, out gameMatchPlayerContextQueue))
            {
                goto Result;
            }
            //5 向匹配队列加入该队伍  方法内修改matchTeam的状态
            gameMatchPlayerContextQueue.OnJoinMatchQueue(matchTeam);
            message.State       = S2CM_JoinMatchQueueComplete.Types.State.Ok;
            message.BarrierId   = barrierId;
            message.MatchTeamId = teamId;
Result:
            if (message.State == S2CM_JoinMatchQueueComplete.Types.State.Ok)
            {
                PostLocalMessageToCtx(new SystemSendNetMessage {
                    Message = message
                }, matchTeam.GetMembers());
            }
            else
            {
                PostLocalMessageToCtx(new SystemSendNetMessage {
                    Message = message
                }, playerId);
            }
        }
        /// <summary>
        /// 根据配置文件初始化匹配管理器
        /// 该方法由Server 唯一调用
        /// </summary>
        public bool Initialize(int serverId)
        {
            //初始化匹配队列字典
            m_gameMatchPlayerCtxQueDic = new ConcurrentDictionary <int, GameMatchPlayerContextQueue>();
            //初始化队伍字典
            m_teamDic = new ConcurrentDictionary <UInt64, MatchTeam>();
            //获取关卡配置文件,获取所有的游戏匹配信息
            m_gameBarrierConfigs = GameServer.Instance.m_gameServerGlobalConfig.BarrierConfigs;
            //获取队伍配置文件
            m_gameMatchTeamConfig = GameServer.Instance.m_gameServerGlobalConfig.GameMatchTeam;
            //根据配置文件初始化若干个匹配队列  存入字典中
            foreach (var config in m_gameBarrierConfigs)
            {
                //配置关卡Id 关卡等级 关卡容纳人数
                var queue = new GameMatchPlayerContextQueue(config.Id, config.Level, config.MemberCount, this);
                m_gameMatchPlayerCtxQueDic.TryAdd(config.Id, queue);
            }
            //初始化设置Id生成工具  ps:id由线程安全进行累加
            m_roomIdFactory = new SessionIdFactory(serverId);

            return(true);
        }