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); } }
void FillBuffPack(DTOBuffPack buffPack, bool homeFlag, Guid managerId, ArenaTeammemberFrame arenaFrame, List <TeammemberEntity> rawMembers = null, string siteId = "") { FillBuffPackRaw(buffPack, homeFlag, managerId, arenaFrame, rawMembers, siteId); var dicAll = buffPack.GetBuffPlayers(homeFlag); var lstOn = buffPack.GetOnBuffPlayers(homeFlag); if (null != dicAll && null != lstOn) { return; } var members = buffPack.GetRawMembers(homeFlag); var pids = buffPack.GetOnPids(homeFlag); var form = buffPack.GetSolution(homeFlag); dicAll = new Dictionary <Guid, DTOBuffPlayer>(members.Count); lstOn = new List <DTOBuffPlayer>(12); int pid = 0; Guid tid = Guid.Empty; DicPlayerEntity cfg = null; DTOBuffPlayer buffP = null; int showOrder = 1; foreach (var kvp in form.PlayerDic) { pid = kvp.Key; cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg || !pids.TryGetValue(pid, out tid)) { throw new Exception(string.Format("BuffDataCore:Manager[{0}] Miss Player[{1}] With Config Or Member", managerId, pid)); } buffP = CreateBuffPlayer(cfg, showOrder++); buffP.Pos = buffP.PosOn = kvp.Value.Position; buffP.ActionSkill = kvp.Value.SkillCode; dicAll[tid] = buffP; lstOn.Add(buffP); } foreach (var kvp in members) { pid = kvp.Value.PlayerId; tid = kvp.Key; if (dicAll.ContainsKey(tid)) { continue; } cfg = PlayersdicCache.Instance.GetPlayer(pid); if (null == cfg) { continue; } buffP = CreateBuffPlayer(cfg, showOrder++, -cfg.Idx); dicAll[tid] = buffP; } buffPack.SetBuffPlayers(homeFlag, dicAll); buffPack.SetOnBuffPlayers(homeFlag, lstOn); }
/// <summary> /// 填充球员数据 /// 装备数据,副卡加成,成长加点,阵型加成,等级加成 /// </summary> /// <param name="buffPack"></param> /// <param name="homeFlag"></param> public static void FillTeammemberData(DTOBuffPack buffPack, bool homeFlag, string siteId = "") { try { var managerSBMList = new List <string>(); buffPack.SetSBM(homeFlag, managerSBMList); var members = buffPack.GetRawMembers(homeFlag); var buffPlayers = buffPack.GetBuffPlayers(homeFlag); //套装字典 套装id->数量 Dictionary <int, List <int> > suitDic = new Dictionary <int, List <int> >(); //套装id->套装类型 Dictionary <int, int> suitTypeDic = new Dictionary <int, int>(); foreach (var teammember in members.Values) { var buffPlayer = buffPlayers[teammember.Idx]; buffPlayer.SBMList = new List <string>(); buffPlayer.Strength = teammember.Strength; buffPlayer.Level = teammember.Level; buffPlayer.ArousalLv = teammember.ArousalLv; ////球星技能 buffPlayer.StarSkill = CacheFactory.PlayersdicCache.GetStarSkill(buffPlayer.AsPid, buffPlayer.Strength, teammember.ArousalLv); //装备和副卡 徽章 FillEquipData(buffPlayer, teammember.Equipment, ref suitDic, ref suitTypeDic); //成长 FillTeammemberGrowData(teammember, buffPlayer); //等级 FillTeammemberLevelData(teammember, buffPlayer); //球员星级 TheStarPlayerCardData(teammember, buffPlayer); //球星潜力 FillPlayerCardData(buffPlayer, teammember); } //套装 FillSuitData(suitDic, suitTypeDic, ref managerSBMList); //阵型加成 var solution = buffPack.GetSolution(homeFlag); FillFormationData(solution.FormationId, solution.FormationLevel, ref managerSBMList); //教练加成 FillCoachData(buffPack.GetMid(homeFlag), managerSBMList, siteId); } catch (Exception ex) { LogHelper.Insert(ex, "TeammemberDataHelper:FillTeammemberData"); } }
void FillBuffView(DTOBuffMemberView buffView, DTOBuffPack buffPack, bool homeFlag, bool fillProp = true, int fillKpi = 0) { var solution = buffPack.GetSolution(homeFlag); FillBuffView(buffView, buffPack.GetBuffPlayers(homeFlag), fillProp, fillKpi, solution.FormationId); }