示例#1
0
        void FillBuffPackRaw(DTOBuffPack buffPack, bool homeFlag, Guid managerId, ArenaTeammemberFrame arenaFrame, List <TeammemberEntity> rawMembers = null, string siteId = "")
        {
            bool memFlag = string.IsNullOrEmpty(siteId);

            buffPack.SetMid(homeFlag, managerId);
            bool topFlag = null == rawMembers;
            var  members = buffPack.GetRawMembers(homeFlag);
            var  pids    = buffPack.GetOnPids(homeFlag);
            var  form    = buffPack.GetSolution(homeFlag);

            if (null == members || null != rawMembers)
            {
                if (null == rawMembers)
                {
                    rawMembers = BuffUtil.GetRawMembers(managerId, homeFlag, arenaFrame, siteId);
                    if (null == rawMembers)
                    {
                        throw new Exception(string.Format("BuffDataCore:Manager[{0}] site[{1}] Miss RawMembers", managerId, siteId));
                    }
                }
                members = rawMembers.ToDictionary(i => i.Idx, i => i);
                buffPack.SetRawMembers(homeFlag, members);
            }
            if (null == pids || null == form)
            {
                form = BuffUtil.GetSolutionArena(arenaFrame);
                var pDic = new Dictionary <int, Guid>(members.Count);
                foreach (var entity in members.Values)
                {
                    pDic.Add(entity.PlayerId, entity.Idx);
                }
                int  pid = 0;
                Guid tid = Guid.Empty;
                if (form.PlayerDic == null)
                {
                    form.PlayerDic = new Dictionary <int, Entity.NBall.Custom.Teammember.SolutionPlayerEntity>();
                }
                pids = new Dictionary <int, Guid>(form.PlayerDic.Count);
                foreach (var kvp in form.PlayerDic)
                {
                    pid = kvp.Key;
                    if (!pDic.TryGetValue(pid, out tid))
                    {
                        break;
                    }
                    pids[pid] = tid;
                }
                pDic.Clear();
                //if (pids.Count != CNTPlayersOn && topFlag)
                //{
                //    if (memFlag)
                //        MemcachedFactory.ArenaSolutionClient.Delete(arenaFrame.ArenaType.ToString() + managerId.ToString());
                //    buffPack.SetSolution(homeFlag, null);
                //    FillBuffPackRaw(buffPack, homeFlag, managerId,arenaFrame, BuffUtil.GetRawMembers(managerId, homeFlag,arenaFrame, siteId), siteId);
                //    return;
                //}
                buffPack.SetSolution(homeFlag, form);
                buffPack.SetOnPids(homeFlag, pids);
            }
        }
示例#2
0
        DTOBuffMemberView GetMembers4Db(Guid managerId, ManagerSkillUseWrap use, ArenaTeammemberFrame arenaFrame)
        {
            if (!FrameConfig.SWAPBuffDataReadDb ||
                null == use || use.Raw.SyncFlag != 0)
            {
                return(null);
            }
            var rawMembers = BuffUtil.GetRawMembers(managerId, true, arenaFrame);
            var members    = NbManagerbuffmemberMgr.GetByMid(managerId, ShareUtil.GetTableMod(managerId));
            //var extra = NbManagerextraMgr.GetById(managerId);
            var             dic = new Dictionary <Guid, NbManagerbuffmemberEntity>(members.Count);
            DicPlayerEntity cfg = null;

            foreach (var item in members)
            {
                cfg = PlayersdicCache.Instance.GetPlayer(Math.Abs(item.Pid));
                if (null == cfg)
                {
                    continue;
                }
                FillBuffMemberProp(item, cfg);
                item.ReadySkillList = item.ReadySkills.Split(',').ToList();
                item.LiveSkillList  = item.LiveSkills.Split(',').ToList();
            }
            var data = CreateBuffView(managerId, use, rawMembers.ToDictionary(i => i.Idx, i => i));

            data.Kpi          = arenaFrame.Kpi;
            data.SyncIdleFlag = false;
            data.BuffMembers  = dic;
            return(data);
        }