Exemplo n.º 1
0
        /// <summary>
        /// 获取阵型,计算阵型等级,和球员位置,技能
        /// </summary>
        /// <param name="arenaTeammemberFrame"></param>
        /// <returns></returns>
        public static NbSolutionEntity GetArenaSolution(ArenaTeammemberFrame arenaTeammemberFrame)
        {
            var cacheKey = arenaTeammemberFrame.ArenaType.ToString() + arenaTeammemberFrame.ManagerId.ToString();
            var entity   = MemcachedFactory.ArenaSolutionClient.Get <NbSolutionEntity>(cacheKey);

            if (entity == null)
            {
                entity = NbSolutionMgr.GetById(arenaTeammemberFrame.ManagerId, arenaTeammemberFrame.ZoneName);
                if (entity == null)
                {
                    return(null);
                }
                entity.FormationId = arenaTeammemberFrame.SolutionId;
                var formationData = new FormationDataListEntity(entity.FormationData);
                entity.FormationLevel = formationData.GetLevel(entity.FormationId);
                var formationDetails = CacheFactory.FormationCache.GetFormationDetail(entity.FormationId);
                var playerIdList     = arenaTeammemberFrame.PlayerList;
                var skillList        = arenaTeammemberFrame.SkillList;

                entity.PlayerDic = new Dictionary <int, SolutionPlayerEntity>(playerIdList.Count);
                for (int i = 0; i < playerIdList.Count; i++)
                {
                    if (playerIdList[i] == 0)
                    {
                        continue;
                    }
                    entity.PlayerDic.Add(playerIdList[i],
                                         MatchDataUtil.BuildSolutionPlayer(playerIdList, formationDetails, playerIdList[i], skillList[i]));
                }
                entity.PlayerString = arenaTeammemberFrame.PlayerString;
                entity.SkillString  = arenaTeammemberFrame.SkillString;
                MemcachedFactory.ArenaSolutionClient.Set(cacheKey, entity);
            }
            return(entity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取阵型,计算阵型等级,和球员位置,技能
        /// </summary>
        /// <param name="managerId"></param>
        /// <returns></returns>
        public static NbSolutionEntity GetSolution(Guid managerId, string siteId = "")
        {
            bool             memFlag = string.IsNullOrEmpty(siteId);
            NbSolutionEntity entity  = null;

            if (memFlag)
            {
                entity = MemcachedFactory.SolutionClient.Get <NbSolutionEntity>(managerId);
            }
            if (entity == null)
            {
                entity = NbSolutionMgr.GetById(managerId, siteId);
                if (entity == null)
                {
                    return(null);
                }
                var formationData = new FormationDataListEntity(entity.FormationData);
                entity.FormationLevel = formationData.GetLevel(entity.FormationId);
                var formationDetails = CacheFactory.FormationCache.GetFormationDetail(entity.FormationId);
                var playerIdList     = FrameUtil.CastIntList(entity.PlayerString, ',');

                ////获取租借球员str,如果与实际阵容的str不同,就用虚拟的替换当前的,不改变实际阵容的str
                //var virtualPlayerIdList = FrameUtil.CastIntList(entity.HirePlayerString, ',');
                //for (int i = 0; i < playerIdList.Count; i++)
                //{
                //    for (int j = 0; j < virtualPlayerIdList.Count; j++)
                //    {
                //        if (playerIdList[i] != virtualPlayerIdList[j] && virtualPlayerIdList[j] != 0)
                //        {
                //            playerIdList[i] = virtualPlayerIdList[j];
                //        }
                //    }
                //}
                var skillList = new string[11];
                if (!string.IsNullOrEmpty(entity.SkillString))
                {
                    skillList = entity.SkillString.Split(',');
                }
                entity.PlayerDic = new Dictionary <int, SolutionPlayerEntity>(playerIdList.Count);
                for (int i = 0; i < playerIdList.Count; i++)
                {
                    entity.PlayerDic.Add(playerIdList[i], MatchDataUtil.BuildSolutionPlayer(playerIdList, formationDetails, playerIdList[i], skillList[i]));
                }
                if (memFlag)
                {
                    MemcachedFactory.SolutionClient.Set(managerId, entity);
                }
            }
            return(entity);
        }
Exemplo n.º 3
0
        public static void BuildManagerData(ManagerInput dstData, DTOBuffMemberView buffView, int vipLevel, int buffScale, bool isGuide = false)
        {
            if (null == dstData)
            {
                return;
            }
            dstData.Players = new List <PlayerInput>(11);

            var legendCount = 0;

            foreach (var buffMember in buffView.BuffMembers.Values)
            {
                if (buffMember.IsMain)
                {
                    var cachePlayer = MatchDataUtil.GetDicPlayer(buffMember.Tid, buffMember.Pid);
                    if (cachePlayer.CardLevel == 2 || cachePlayer.CardLevel == 1 || cachePlayer.CardLevel == 7 || cachePlayer.CardLevel == 8)
                    {
                        legendCount++;
                    }
                }
            }
            buffScale += CacheFactory.AppsettingCache.GetSolutionLegendAndVipPlus(legendCount, vipLevel);
            double buffPlus = buffScale / 100.00;

            foreach (var buffMember in buffView.BuffMembers.Values)
            {
                if (buffMember.IsMain)
                {
                    var         cachePlayer          = MatchDataUtil.GetDicPlayer(buffMember.Tid, buffMember.Pid);
                    PlayerInput transferPlayerEntity = new PlayerInput();
                    transferPlayerEntity.FamilyName = cachePlayer.Name;
                    transferPlayerEntity.Height     = (int)cachePlayer.Stature;
                    transferPlayerEntity.Pid        = buffMember.Pid;
                    transferPlayerEntity.Plus       = (byte)buffMember.Strength;
                    transferPlayerEntity.Position   = (byte)buffMember.PPos;
                    BuildTeammemberData(transferPlayerEntity, buffMember, buffPlus, isGuide);
                    dstData.Players.Add(transferPlayerEntity);
                }
            }
            if (isGuide)
            {
                var list       = CacheFactory.NpcdicCache.GetGuidePlayers();
                int count      = list.Count;
                int totalCount = dstData.Players.Count;
                for (int i = 1; i <= count; i++)
                {
                    PlayerInputClone(dstData.Players[totalCount - i], list[i - 1]);
                }
            }
        }
Exemplo n.º 4
0
        static DTOBuffPlayer BuildPlayer(int level, int propertyPoint, int strength, int playerId, int equipId, string skill, int position, int buffScale, ref Dictionary <int, List <int> > suitDic, ref Dictionary <int, int> suitTypeDic)
        {
            DicPlayerEntity cfg      = MatchDataUtil.GetDicPlayer(Guid.Empty, playerId);
            var             rawProps = cfg.GetRawProps();
            var             obj      = new DTOBuffPlayer();

            obj.Pid   = cfg.Idx;
            obj.Pos   = position;
            obj.Clr   = cfg.CardLevel;
            obj.Props = new DTOBuffProp[rawProps.Length];

            for (int i = 0; i < rawProps.Length; ++i)
            {
                obj.Props[i] = new DTOBuffProp {
                    Orig = rawProps[i]
                };
                obj.Props[i].Percent = (buffScale - 100) / 100.00;
            }
            if (propertyPoint > 0)
            {
                switch (position)
                {
                case (int)EnumPosition.Forward:
                    obj.Props[0].Point += propertyPoint;
                    obj.Props[1].Point += propertyPoint;
                    obj.Props[2].Point += propertyPoint;
                    obj.Props[3].Point += propertyPoint;
                    break;

                case (int)EnumPosition.Midfielder:
                    obj.Props[10].Point += propertyPoint;
                    obj.Props[11].Point += propertyPoint;
                    obj.Props[12].Point += propertyPoint;
                    obj.Props[3].Point  += propertyPoint;
                    break;

                case (int)EnumPosition.Fullback:
                    obj.Props[7].Point += propertyPoint;
                    obj.Props[8].Point += propertyPoint;
                    obj.Props[9].Point += propertyPoint;
                    break;

                case (int)EnumPosition.Goalkeeper:
                    obj.Props[13].Point += propertyPoint;
                    obj.Props[14].Point += propertyPoint;
                    obj.Props[15].Point += propertyPoint;
                    break;
                }
            }
            rawProps        = null;
            obj.Level       = level;
            obj.Strength    = strength;
            obj.SBMList     = new List <string>();
            obj.ActionSkill = skill;
            //obj.StarSkill = CacheFactory.PlayersdicCache.GetStarSkill(obj.AsPid, obj.Strength);
            EquipmentUsedEntity equipment = null;

            if (equipId > 0)
            {
                equipment          = new EquipmentUsedEntity();
                equipment.Property = CacheFactory.EquipmentCache.RandomEquipmentPropertyForNpc(equipId);
            }
            //装备和副卡
            //TeammemberDataHelper.FillEquipData(obj, equipment, null, null, ref suitDic, ref suitTypeDic);

            return(obj);
        }