Пример #1
0
        /// <summary>
        /// 多人副本获胜加一次
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="plotID"></param>
        public static void DailyMorePlotRestrainNum(string userID, int plotID)
        {
            UserDailyRestrain dailyRestrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(userID);
            if (dailyRestrain != null && dailyRestrain.UserExtend != null)
            {
                FunPlot plot = new FunPlot();
                plot.PlotID = plotID;
                plot.Num = 1;
                plot.MoreDate = DateTime.Now;

                dailyRestrain.UserExtend.UpdateNotify(obj =>
                {
                    if (dailyRestrain.UserExtend.MorePlot == null)
                    {
                        dailyRestrain.UserExtend.MorePlot = new CacheList<FunPlot>();
                    }
                    dailyRestrain.UserExtend.MorePlot.Add(plot);
                    return true;
                });
                //dailyRestrain.Update();
            }
        }
Пример #2
0
 /// <summary>
 /// 英雄副本副本增加挑战次数
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="plotID"></param>
 /// <param name="_cityID"></param>
 public static void HeroDailyRestrain(string userID, int plotID, int _cityID)
 {
     var cacheSet = new GameDataCacheSet<UserDailyRestrain>();
     UserDailyRestrain userRestrain = cacheSet.FindKey(userID);
     if (userRestrain != null)
     {
         DailyUserExtend userExtend = new DailyUserExtend();
         List<HeroPlot> heroList = new List<HeroPlot>();
         if (userRestrain.UserExtend != null)
         {
             userExtend = userRestrain.UserExtend;
             if (userRestrain.UserExtend.HeroPlot.Count > 0)
             {
                 heroList = userRestrain.UserExtend.HeroPlot;
             }
         }
         HeroPlot plot = heroList.Find(m => m.CityID.Equals(_cityID));
         if (plot != null)
         {
             plot.HeroList.Add(new FunPlot() { PlotID = plotID });
         }
         else
         {
             FunPlot funPlot = new FunPlot();
             funPlot.PlotID = plotID;
             List<FunPlot> funPlotsList = new List<FunPlot>();
             funPlotsList.Add(funPlot);
             heroList.Add(new HeroPlot() { CityID = _cityID, HeroNum = 0, HeroList = funPlotsList });
         }
         userExtend.HeroPlot = heroList;
         userRestrain.UserExtend = userExtend;
         cacheSet.Update();
     }
 }
Пример #3
0
        /// <summary>
        /// 天地劫挑战次数
        /// </summary>
        /// <param name="plotNPCInfo"></param>
        private void KalpaDailyRestrain(PlotNPCInfo plotNPCInfo)
        {
            UserDailyRestrain userRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(Uid);
            if (userRestrain == null)
            {
                userRestrain = new UserDailyRestrain() { UserID = Uid, FunPlot = new CacheList<FunPlot>() };
            }
            if (userRestrain.UserExtend == null)
            {
                userRestrain.UserExtend = new DailyUserExtend();
                userRestrain.UserExtend.KalpaPlot = new CacheList<FunPlot>();
            }
            int plotNum = 0;
            FunPlot funPlot = userRestrain.UserExtend.KalpaPlot.Find(m => m.PlotID == plotNPCInfo.PlotID);
            if (funPlot == null)
            {
                plotNum = 1;
            }
            else
            {
                plotNum = MathUtils.Addition(funPlot.Num, 1, int.MaxValue);
                userRestrain.UserExtend.UpdateNotify(obj =>
                    {
                        userRestrain.UserExtend.KalpaPlot.Remove(funPlot);
                        return true;
                    });
            }
            funPlot = new FunPlot
            {
                PlotID = plotNPCInfo.PlotID,
                Num = plotNum
            };
            userRestrain.UserExtend.UpdateNotify(obj =>
                {
                    userRestrain.UserExtend.KalpaPlot.Add(funPlot);
                    return true;
                });

        }
Пример #4
0
        /// <summary>
        /// 精英副本挑战次数
        /// </summary>
        /// <param name="plotNPCInfo"></param>
        private void EliteDailyRestrain(PlotNPCInfo plotNPCInfo)
        {
            UserDailyRestrain userRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(Uid);
            if (userRestrain == null)
            {
                userRestrain = new UserDailyRestrain() { UserID = Uid, FunPlot = new CacheList<FunPlot>() };
            }

            int plotNum = 0;
            FunPlot funPlot = null;
            if (userRestrain.FunPlot.Count > 0)
            {
                funPlot = userRestrain.FunPlot.Find(m => m.PlotID == plotNPCInfo.PlotID);
            }
            if (funPlot == null)
            {
                plotNum = 1;
            }
            else
            {
                plotNum = MathUtils.Addition(funPlot.Num, 1, int.MaxValue);
                userRestrain.FunPlot.Remove(funPlot);
            }
            funPlot = new FunPlot
                          {
                              PlotID = plotNPCInfo.PlotID,
                              Num = plotNum
                          };
            userRestrain.FunPlot.Add(funPlot);

        }
Пример #5
0
        /// <summary>
        /// 天地劫挑战次数
        /// </summary>
        /// <param name="plotNPCInfo"></param>
        private void KalpaDailyRestrain(PlotNPCInfo plotNPCInfo)
        {
            var cacheSet = new GameDataCacheSet<UserDailyRestrain>();
            UserDailyRestrain userRestrain = cacheSet.FindKey(Uid);
            if (userRestrain == null)
            {
                userRestrain = new UserDailyRestrain() { UserID = Uid };
                cacheSet.Add(userRestrain);
                userRestrain = cacheSet.FindKey(Uid);
            }
            if (userRestrain.UserExtend == null)
            {
                userRestrain.UserExtend = new DailyUserExtend();
                //userRestrain.UserExtend.KalpaPlot = new List<FunPlot>();
            }
            int plotNum = 0;
            FunPlot funPlot = userRestrain.UserExtend.KalpaPlot.Find(m => m.PlotID == plotNPCInfo.PlotID);
            if (funPlot == null)
            {
                plotNum = 1;
                funPlot = new FunPlot
                {
                    PlotID = plotNPCInfo.PlotID,
                    Num = plotNum
                };
                userRestrain.UserExtend.UpdateNotify(obj =>
                    {
                        userRestrain.UserExtend.KalpaPlot.Add(funPlot);
                        return true;
                    });

            }
        }