Example #1
0
 /// <summary>
 /// 活动开始
 /// </summary>
 /// <param name="teamA"></param>
 /// <param name="teamB"></param>
 /// <param name="players"></param>
 public FightBusinessPro(FightObject[] teamA, FightObject[] teamB, List<PlayerBusiness> players)
     : base(teamA, teamB, players)
 {
     m_lost = 0;
     m_protectTime = 0;
     m_pro = PartProxy.TryGetPart(Part.Pro) as ProBusiness;
 }
Example #2
0
        /// <summary>
        /// 检查活动开始.
        /// </summary>
        /// <param name="part"></param>
        private static void CheckPartStart(Part part)
        {
            PartBusiness pb;
            if (m_parts.TryGetValue(part.ID, out pb))
            {
                return;
            }
            //必须使用本地时间
            DateTime checkTime = DateTime.Now;
            int early = part.Perpare;
            if (early > 0)
            {
                checkTime = DateTime.Now.AddMinutes(early);
            }
            Period period = part.Contains(checkTime);
            if (period == null)
            {
                return;
            }
            DateTime start = period.GetNearStart(checkTime).ToUniversalTime();
            DateTime end = period.GetNearEnd(checkTime).ToUniversalTime();
            //夺宝奇兵
            if (part.ID == Part.Rob)
            {
                pb = new RobBusiness(part);
            }
            //守护战争
            else if (part.ID == Part.Pro)
            {
                pb = new ProBusiness(part);
            }
            //日常打怪
            else if (part.SubType == Part.Hunt)
            {
                pb = new HuntBusiness(part);
            }
            //双倍经验
            else if (part.SubType == Part.DoubleExp)
            {
                pb = new ManyExpBusiness(part);
            }

            if (pb != null && m_parts.TryAdd(part.ID, pb))
            {
                //活动开始
                try
                {
                    pb.Start(start, end);
                    logger.Info("Part start:" + part.Name);
                }
                catch { }
            }
        }