示例#1
0
 /// <summary>
 ///  每日刷新 --每日限制次数
 /// </summary>
 public static void ChechDailyRestrain(string userID)
 {
     GameUser user = new GameDataCacheSet<GameUser>().FindKey(userID);
     if (user != null)
     {
         if (user.UserExtend != null)
         {
             if (user.UserExtend.RefreashDate.Date != DateTime.Now.Date)
             {
                 DailyRefresh dailyRefresh = user.UserExtend.DailyInfo;
                 if (dailyRefresh == null)
                 {
                     dailyRefresh = new DailyRefresh();
                     dailyRefresh.RefreshDate = DateTime.Now;
                     dailyRefresh.MoreNum = 0;
                 }
                 else
                 {
                     dailyRefresh.RefreshDate = DateTime.Now;
                     dailyRefresh.MoreNum = 0;
                 }
                 user.UserExtend.UpdateNotify(obj =>
                 {
                     user.UserExtend.DailyInfo = dailyRefresh;
                     user.UserExtend.RefreashDate = DateTime.Now;
                     user.UserExtend.ItemList.Clear();
                     return true;
                 });
                 //user.Update();
             }
         }
         else
         {
             if (user.UserExtend == null) user.UserExtend = new GameUserExtend();
             user.UserExtend.RefreashDate = DateTime.Now;
             if (user.UserExtend.DailyInfo == null)
             {
                 user.UserExtend.UpdateNotify(obj =>
                 {
                     user.UserExtend.DailyInfo = new DailyRefresh();
                     user.UserExtend.DailyInfo.RefreshDate = DateTime.Now;
                     user.UserExtend.DailyInfo.MoreNum = 0;
                     return true;
                 });
             }
         }
     }
     UserDailyRestrain userRestrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(userID);
     if (userRestrain != null && DateTime.Now.Date != userRestrain.RefreshDate.Date)
     {
         userRestrain.Funtion1 = 0;
         userRestrain.Funtion2 = 0;
         userRestrain.Funtion3 = 0;
         userRestrain.Funtion4 = 0;
         userRestrain.Funtion5 = 0;
         userRestrain.Funtion6 = 0;
         userRestrain.Funtion7 = 0;
         userRestrain.Funtion8 = 0;
         userRestrain.Funtion9 = 0;
         userRestrain.Funtion10 = 0;
         userRestrain.FunPlot.Clear();
         userRestrain.UserExtend = new DailyUserExtend();
         userRestrain.RefreshDate = DateTime.Now;
         //userRestrain.Update();
     }
 }
示例#2
0
        public override bool TakeAction()
        {
            var plotTeam = new PlotTeamCombat(ContextUser);
            teamCombatResult = plotTeam.GetCombatProcess(teamID);
            teamPlot = plotTeam.GetTeam(teamID);
            plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(plotID);

            if (teamCombatResult.IsWin)
            {
                //日常任务-多人副本
                TaskHelper.TriggerDailyTask(Uid, 4007);

                if (ContextUser.UserExtend != null && ContextUser.UserExtend.DailyInfo != null)
                {
                    if (ContextUser.UserExtend.DailyInfo.RefreshDate.Date == DateTime.Now.Date)
                    {
                        ContextUser.UserExtend.DailyInfo.MoreNum = MathUtils.Addition(ContextUser.UserExtend.DailyInfo.MoreNum, 1);
                    }
                    else
                    {
                        ContextUser.UserExtend.DailyInfo.RefreshDate = DateTime.Now;
                        ContextUser.UserExtend.DailyInfo.MoreNum = 1;
                    }
                }
                else if (ContextUser.UserExtend != null)
                {
                    DailyRefresh dailyRefresh = new DailyRefresh();
                    dailyRefresh.RefreshDate = DateTime.Now;
                    dailyRefresh.MoreNum = 1;
                    ContextUser.UserExtend.DailyInfo = dailyRefresh;
                }
                //ContextUser.Update();
            }

            return true;
        }