예제 #1
0
        /// <summary>
        /// 计算一个教练的属性
        /// </summary>
        /// <param name="coachInfo"></param>
        /// <returns></returns>
        private bool CalculateKpi(CoachFrameEntity coachInfo)
        {
            var config = CacheFactory.CoachCache.GetCoachInfo(coachInfo.CoachId);

            if (config == null)
            {
                return(false);
            }
            int coachLevel = coachInfo.CoachLevel - 1;

            coachInfo.Offensive      = Kpi(config.Offensive, coachLevel, coachInfo.CoachStar);
            coachInfo.Organizational = Kpi(config.Organizational, coachLevel, coachInfo.CoachStar);
            coachInfo.Defense        = Kpi(config.Defense, coachLevel, coachInfo.CoachStar);
            coachInfo.BodyAttr       = Kpi(config.BodyAttr, coachLevel, coachInfo.CoachStar);
            coachInfo.Goalkeeping    = Kpi(config.Goalkeeping, coachLevel, coachInfo.CoachStar);

            CalculateKpi();
            return(true);
        }
예제 #2
0
        /// <summary>
        /// 激活教练
        /// </summary>
        /// <param name="coachId"></param>
        public bool TheActivation(int coachId)
        {
            if (IsHaveCoach(coachId))
            {
                return(false);
            }
            var config = CacheFactory.CoachCache.GetCoachInfo(coachId);

            if (config == null)
            {
                return(false);
            }
            var upgradeConfig = CacheFactory.CoachCache.GetCoachUpgradeInfo(1);
            var starConfig    = CacheFactory.CoachCache.GetCoachStarInfo(coachId, 0);

            if (upgradeConfig == null || starConfig == null)
            {
                return(false);
            }
            var coachInfo = new CoachFrameEntity(coachId, config.Offensive, config.Organizational, config.Defense, config.BodyAttr, config.Goalkeeping, upgradeConfig.UpgradeExp, starConfig.ConsumeDebris);

            CoachDic.Add(coachId, coachInfo);
            if (_entity.EnableCoachId == 0)
            {
                _entity.EnableCoachId         = coachId;
                _entity.EnableCoachLevel      = 1;
                _entity.EnableCoachStar       = 0;
                _entity.EnableCoachSkillLevel = 1;
                _entity.Offensive            += config.Offensive;
                _entity.Organizational       += config.Organizational;
                _entity.Defense     += config.Defense;
                _entity.BodyAttr    += config.BodyAttr;
                _entity.Goalkeeping += config.Goalkeeping;
            }
            return(true);
        }