Example #1
0
        /// <summary>
        /// 删除副本, 检测是否是跨服,是否需要上报中心
        /// </summary>
        /// <param name="FuBenSeqId"></param>
        public void OnCopyRemove(int FuBenSeqId)
        {
            long teamId = -1;

            lock (Mutex)
            {
                if (!this.FuBenSeq2TeamId.TryGetValue(FuBenSeqId, out teamId))
                {
                    return;
                }

                FuBenSeq2TeamId.Remove(FuBenSeqId);

                CopyTeamData td;
                if (!TeamDict.TryGetValue(teamId, out td))
                {
                    return;
                }

                OnTeamDestroy(new CopyTeamDestroyData()
                {
                    TeamId = teamId
                });
                if (IsKuaFuCopy(td.FuBenId))
                {
                    KFCopyRpcClient.getInstance().KFCopyTeamRemove(teamId);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 队伍销毁 回调
        /// </summary>
        /// <param name="data"></param>
        private void OnTeamDestroy(CopyTeamDestroyData data)
        {
            if (data == null)
            {
                return;
            }

            lock (Mutex)
            {
                CopyTeamData td = null;
                if (!TeamDict.TryGetValue(data.TeamId, out td))
                {
                    return;
                }

                TeamDict.Remove(data.TeamId);
                FuBenSeq2TeamId.Remove(td.FuBenSeqID);
                HashSet <long> teamList = null;
                if (FuBenId2Teams.TryGetValue(td.FuBenId, out teamList))
                {
                    teamList.Remove(td.TeamID);
                }

                foreach (var member in td.TeamRoles)
                {
                    RoleId2JoinedTeam.Remove(member.RoleID);

                    if (member.ServerId != ThisServerId)
                    {
                        continue;
                    }

                    GameClient client = GameManager.ClientMgr.FindClient(member.RoleID);
                    if (client != null)
                    {
                        NotifyTeamStateChanged(client, (int)CopyTeamErrorCodes.LeaveTeam, member.RoleID, 0);
                    }
                }

                // 队长id设为-1, 通知整个队伍
                td.LeaderRoleID = -1;
                NotifyTeamData(td);

                // 清空队伍,然后通知给所有关注列表的人
                td.TeamRoles.Clear();
                td.MemberCount = td.TeamRoles.Count;
                NotifyTeamListChange(td);
            }
        }