当前位置: 首页>>代码示例>>C#>>正文


C# PersonalCacheStruct.Update方法代码示例

本文整理汇总了C#中PersonalCacheStruct.Update方法的典型用法代码示例。如果您正苦于以下问题:C# PersonalCacheStruct.Update方法的具体用法?C# PersonalCacheStruct.Update怎么用?C# PersonalCacheStruct.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PersonalCacheStruct的用法示例。


在下文中一共展示了PersonalCacheStruct.Update方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateGeneral

        private void CreateGeneral(CareerInfo careerInfo)
        {
            GeneralInfo general = new ShareCacheStruct<GeneralInfo>().FindKey(generalID);
            List<UserGeneral> userGeneralArray = new PersonalCacheStruct<UserGeneral>().FindAll(UserId.ToString());
            if (userGeneralArray.Count > 0 || general == null)
            {
                return;
            }

            UserGeneral userGeneral = new UserGeneral();
            userGeneral.UserID = UserId.ToString();
            userGeneral.GeneralID = general.GeneralID;
            userGeneral.GeneralName = general.GeneralName;
            userGeneral.HeadID = general.HeadID;
            userGeneral.PicturesID = general.PicturesID;
            userGeneral.GeneralLv = (short)careerInfo.Lv;
            userGeneral.GeneralType = GeneralType.YongHu;
            userGeneral.CareerID = _careerID;
            userGeneral.PowerNum = general.PowerNum;
            userGeneral.SoulNum = general.SoulNum;
            userGeneral.IntellectNum = general.IntellectNum;
            userGeneral.TrainingPower = 0;
            userGeneral.TrainingSoul = 0;
            userGeneral.TrainingIntellect = 0;
            userGeneral.AbilityID = general.AbilityID;
            userGeneral.Momentum = 0;
            userGeneral.Description = string.Empty;
            userGeneral.HitProbability = ConfigEnvSet.GetDecimal("Combat.HitiNum");
            userGeneral.GeneralStatus = GeneralStatus.DuiWuZhong;
            userGeneral.CurrExperience = 0;
            userGeneral.Experience1 = 0;
            userGeneral.Experience2 = 0;
            //userGeneral.LifeNum = MathUtils.Addition(general.LifeNum, careerInfo.LifeIncreaseNum * (MathUtils.Subtraction(careerInfo.Lv, (short)1, (short)0)), int.MaxValue);
            userGeneral.RefreshMaxLife();
            userGeneral.HeritageType = HeritageType.Normal;
            userGeneral.AbilityNum = 3;
            var cacheSet = new PersonalCacheStruct<UserGeneral>();
            cacheSet.Add(userGeneral);
            cacheSet.Update();
            UserAbilityHelper.AddUserAbility(general.AbilityID, UserId, generalID, 1);
          
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:42,代码来源:Action1005.cs

示例2: CreateGameUser

        private GameUser CreateGameUser(bool userSex)
        {
            GameUser userEntity = new GameUser
            {
                UserID = UserId.ToString(),
                CountryID = 0,
                CityID = ConfigEnvSet.GetInt("user.UserMinCityID"),
                PointX = (short)ConfigEnvSet.GetInt("User.CityPointX"),
                PointY = (short)ConfigEnvSet.GetInt("User.CityPointY"),
                SessionID = Sid,
                NickName = UserName,
                Sex = userSex,
                UserLv = (short)ConfigEnvSet.GetInt("User.Level"),
                ObtainNum = ConfigEnvSet.GetInt("User.ObtainNum"),
                EnergyNum = new GameUser().EnergyMaxNum,
                MercenariesID = string.Empty,
                GiftGold = ConfigEnvSet.GetInt("User.GiftGold"),
                PayGold = 0,
                UseGold = 0,
                ItemGold = 0,
                GameCoin = ConfigEnvSet.GetInt("User.GameCoin"),
                ExpNum = 0,
                VipLv = ConfigEnvSet.GetInt("User.VipLv"),
                UserStatus = UserStatus.Normal,
                MsgState = true,
                GridNum = new GameUser().GridMinNum,
                WarehouseNum = new GameUser().WarehouseMinNum,
                QueueNum = 0,
                RetailID = RetailID,
                Pid = Pid,
                MobileType = MobileType,
                ScreenX = ScreenX,
                ScreenY = ScreenY,
                ClientAppVersion = ReqAppVersion,
                CreateDate = DateTime.Now,
                UseMagicID = new GameUser().UserMagicID,
                CrystalNum = new GameUser().CrystalMinNum,
                UserLocation = Location.City,
                UserExtend = new GameUserExtend(),
                SweepPool = new SweepPoolInfo(),
                GameId = GameID,
                ServerId = ServerID,
                LoginTime = DateTime.Now,
                DailyLoginTime = DateTime.Now
            };
            var cacheSet = new PersonalCacheStruct<GameUser>();
            cacheSet.Add(userEntity);
            cacheSet.Update();
            //增加初始背包、灵件、水晶
            new PersonalCacheStruct<UserItemPackage>().Add(new UserItemPackage { UserID = userEntity.UserID });
            new PersonalCacheStruct<UserCrystalPackage>().Add(new UserCrystalPackage() { UserID = userEntity.UserID });
            new PersonalCacheStruct<UserSparePackage>().Add(new UserSparePackage() { UserID = userEntity.UserID });
            //增加初始附魔符
            new PersonalCacheStruct<UserEnchant>().Add(new UserEnchant(userEntity.UserID));
            //增加初始副本
            new PersonalCacheStruct<UserPlotPackage>().Add(new UserPlotPackage(userEntity.UserID));
            // 增加初始集邮册
            new PersonalCacheStruct<UserAlbum>().Add(new UserAlbum(userEntity.UserID));
            // 玩家圣吉塔
            new PersonalCacheStruct<UserShengJiTa>().Add(new UserShengJiTa(userEntity.UserID.ToInt()));

            return userEntity;
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:63,代码来源:Action1005.cs

示例3: CreateDailyRestrain

        private void CreateDailyRestrain()
        {
            if (new PersonalCacheStruct<UserDailyRestrain>().FindKey(UserId.ToString()) == null)
            {
                UserDailyRestrain dailyRestrain = new UserDailyRestrain();

                dailyRestrain.UserID = UserId.ToString();
                dailyRestrain.RefreshDate = DateTime.Now;
                dailyRestrain.Funtion1 = 0;
                dailyRestrain.Funtion2 = 0;
                dailyRestrain.Funtion3 = 0;
                dailyRestrain.Funtion4 = 0;
                dailyRestrain.Funtion5 = 0;
                dailyRestrain.Funtion6 = 0;
                dailyRestrain.Funtion7 = 0;
                dailyRestrain.Funtion8 = 0;
                dailyRestrain.Funtion9 = 0;
                var cacheSet = new PersonalCacheStruct<UserDailyRestrain>();
                cacheSet.Add(dailyRestrain);
                cacheSet.Update();
            }
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:22,代码来源:Action1005.cs

示例4: CreateMagic

        private void CreateMagic(GameUser userEntity)
        {
            UserMagic userMagic = new UserMagic
            {
                UserID = userEntity.UserID,
                IsEnabled = true,
                MagicID = new GameUser().UserMagicID,
                MagicLv = 1,
                MagicType = MagicType.MoFaZhen
            };
            var cacheUserMagic = new PersonalCacheStruct<UserMagic>();
            cacheUserMagic.Add(userMagic);
            cacheUserMagic.Update();

            //初始阵法
            string[] gridRange = new ShareCacheStruct<MagicLvInfo>().FindKey(userMagic.MagicID, userMagic.MagicLv).GridRange.Split(new char[] { ',' });
            if (gridRange.Length > 0)
            {
                string grid = gridRange[0];
                UserEmbattle userEmbattle = new UserEmbattle
                {
                    UserID = userEntity.UserID,
                    GeneralID = generalID,
                    MagicID = userMagic.MagicID,
                    Position = grid.ToShort()

                };
                var cacheEmbattle = new PersonalCacheStruct<UserEmbattle>();
                cacheEmbattle.Add(userEmbattle);
                cacheEmbattle.Update();
            }
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:32,代码来源:Action1005.cs

示例5: HeroRefreshNum

 /// <summary>
 /// 增加刷新次数
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="cityID"></param>
 /// <returns></returns>
 public static void HeroRefreshNum(string userID, int cityID)
 {
     var cacheSet = new PersonalCacheStruct<UserDailyRestrain>();
     UserDailyRestrain dailyRestrain = cacheSet.FindKey(userID);
     if (dailyRestrain != null)
     {
         DailyUserExtend userExtend = new DailyUserExtend();
         List<HeroPlot> heroList = new List<HeroPlot>();
         if (dailyRestrain.UserExtend != null)
         {
             userExtend = dailyRestrain.UserExtend;
             if (dailyRestrain.UserExtend.HeroPlot.Count > 0)
             {
                 heroList = dailyRestrain.UserExtend.HeroPlot;
             }
         }
         HeroPlot plot = heroList.Find(m => m.CityID.Equals(cityID));
         if (plot != null)
         {
             plot.HeroNum = MathUtils.Addition(plot.HeroNum, 1);
         }
         else
         {
             heroList.Add(new HeroPlot() { CityID = cityID, HeroNum = 1, HeroList = new List<FunPlot>() });
         }
         userExtend.HeroPlot = heroList;
         dailyRestrain.UserExtend = userExtend;
     }
     cacheSet.Update();
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:36,代码来源:Action4014.cs

示例6: EnableFunction

 private void EnableFunction()
 {
     string[] funList = ConfigEnvSet.GetString("User.DefaultFunction").Split(new[] { ',' });
     var cacheSet = new PersonalCacheStruct<UserFunction>();
     foreach (string fun in funList)
     {
         if (fun.TrimEnd().Length > 0)
         {
             UserFunction userFun = new UserFunction();
             userFun.UserID = UserId.ToString();
             userFun.FunEnum = fun.ToEnum<FunctionEnum>();
             userFun.CreateDate = DateTime.Now;
             cacheSet.Add(userFun);
             cacheSet.Update();
         }
     }
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:17,代码来源:Action1005.cs

示例7: PayAccumulation

 /// <summary>
 /// 累计消费送礼
 /// </summary>
 public static void PayAccumulation(string userID, int consumeNum)
 {
     FestivalInfo fest = GetInfo(FestivalType.PayAccumulation);
     if (fest == null)
     {
         return;
     }
     var cacheSet = new PersonalCacheStruct<UserConsume>();
     UserConsume userConsume = cacheSet.FindKey(userID);
     if (userConsume == null)
     {
         userConsume = new UserConsume();
         userConsume.UserID = userID;
         userConsume.GameCoin = 0;
         userConsume.GoldNum = 0;
         userConsume.EnergyNum = 0;
         cacheSet.Add(userConsume);
         cacheSet.Update();
         userConsume = new PersonalCacheStruct<UserConsume>().FindKey(userID);
     }
     if (userConsume.GoldDate < fest.StartDate)
     {
         userConsume.GoldDate = fest.StartDate;
         userConsume.GoldNum = consumeNum;
     }
     else
     {
         userConsume.GoldNum = MathUtils.Addition(userConsume.GoldNum, consumeNum);
     }
     var cacheSetRestrain = new PersonalCacheStruct<FestivalRestrain>();
     var festivalList = new ShareCacheStruct<FestivalInfo>().FindAll(s => s.FestivalType == FestivalType.PayAccumulation);
     foreach (var info in festivalList)
     {
         if (!info.IsStop)
             continue;
         if (info.StartDate > DateTime.Now)
             continue;
         if (info.EndDate < DateTime.Now)
             continue;
         if (info.FestivalType == FestivalType.PayAccumulation)
         {
             FestivalRestrain fRest = cacheSetRestrain.FindKey(userID, info.FestivalID);
             if (fRest != null && userConsume.GoldNum >= info.RestrainNum)
             {
                 AppendFestivalRestrain(userID, fest.FestivalID, fest.RestrainNum);
             }
         }
     }
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:52,代码来源:FestivalHelper.cs

示例8: TriggerFestivalConsume

        /// <summary>
        /// 累计消费活动
        /// </summary>
        public static void TriggerFestivalConsume(string userID, int consumeNum, FestivalType festivalType)
        {
            FestivalInfo fest = GetInfo(festivalType);
            if (fest == null)
            {
                return;
            }
            var cacheSet = new PersonalCacheStruct<UserConsume>();
            UserConsume userConsume = cacheSet.FindKey(userID);
            if (userConsume == null)
            {
                userConsume = new UserConsume();
                userConsume.UserID = userID;
                userConsume.GameCoin = 0;
                userConsume.GoldNum = 0;
                userConsume.EnergyNum = 0;
                cacheSet.Add(userConsume);
                cacheSet.Update();
                userConsume = new PersonalCacheStruct<UserConsume>().FindKey(userID);
            }
            //晶石
            if (festivalType == FestivalType.SparConsumption)
            {
                if (userConsume.GoldDate < fest.StartDate)
                {
                    userConsume.GoldDate = fest.StartDate;
                    userConsume.GoldNum = consumeNum;
                }
                else
                {
                    userConsume.GoldNum = MathUtils.Addition(userConsume.GoldNum, consumeNum);
                }
            }

            //金币
            if (festivalType == FestivalType.GameCoin)
            {
                if (userConsume.CoinDate < fest.StartDate)
                {
                    userConsume.CoinDate = fest.StartDate;
                    userConsume.GameCoin = consumeNum;
                }
                else
                {
                    userConsume.GameCoin = MathUtils.Addition(userConsume.GameCoin, consumeNum);
                }
            }

            //精力
            if (festivalType == FestivalType.Energy)
            {
                if (userConsume.EnergyDate < fest.StartDate)
                {
                    userConsume.EnergyDate = fest.StartDate;
                    userConsume.EnergyNum = consumeNum;
                }
                else
                {
                    userConsume.EnergyNum = MathUtils.Addition(userConsume.EnergyNum, consumeNum);
                }
            }
            FestivalInfo[] festivalInfosArray =
              new ShareCacheStruct<FestivalInfo>().FindAll(m => m.FestivalType == festivalType).ToArray();
            foreach (FestivalInfo festivalInfo in festivalInfosArray)
            {
                FestivalConsumeCount(festivalInfo, userID);
            }
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:71,代码来源:FestivalHelper.cs

示例9: AddCardReward

 public static void AddCardReward(string userID, string cardUserID, short userlv)
 {
     var cacheSet = new PersonalCacheStruct<UserCardReward>();
     UserCardReward cardReward = new UserCardReward();
     cardReward.UserID = userID;
     cardReward.CardUserID = cardUserID;
     cardReward.UserLv = userlv;
     cardReward.CreateDate = DateTime.Now;
     cacheSet.Add(cardReward);
     cacheSet.Update();
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:11,代码来源:FestivalHelper.cs

示例10: TakeAction

 public override bool TakeAction()
 {
     if (!UserHelper.IsOpenFunction(ContextUser.UserID, FunctionEnum.Trump))
     {
         ErrorCode = LanguageManager.GetLang().ErrorCode;
         ErrorInfo = LanguageManager.GetLang().St_NoFun;
         return false;
     }
     if (UserHelper.IsOpenFunction(ContextUser.UserID, FunctionEnum.TrumpPractice))
     {
         return false;
     }
     if (!TrumpHelper.IsTrumpPractice(ContextUser.UserID))
     {
         return false;
     }
     var cacheTrump = new PersonalCacheStruct<UserTrump>();
     UserTrump userTrump = cacheTrump.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
     if (userTrump == null)
     {
         TrumpInfo trumpInfo = new ShareCacheStruct<TrumpInfo>().FindKey(TrumpInfo.CurrTrumpID, 1);
         if (trumpInfo == null)
         {
             return false;
         }
         StoryTaskInfo[] storyTaskArray = new ShareCacheStruct<StoryTaskInfo>().FindAll(m => m.TaskType == TaskType.Trump).ToArray();
         foreach (StoryTaskInfo taskInfo in storyTaskArray)
         {
             UserItemHelper.UseUserItem(ContextUser.UserID, taskInfo.TargetItemID, taskInfo.TargetItemNum);
         }
         userTrump = new UserTrump(ContextUser.UserID, TrumpInfo.CurrTrumpID);
         userTrump.TrumpLv = 1;
         userTrump.WorshipLv = 1;
         userTrump.LiftNum = trumpInfo.MaxLift;
         userTrump.Experience = 0;
         userTrump.MatureNum = trumpInfo.BeseMature;
         userTrump.Zodiac = TrumpHelper.GetZodiacType(ZodiacType.NoZodiac);
         //userTrump.SkillInfo = new List<SkillInfo>();
         //userTrump.PropertyInfo = new List<GeneralProperty>();
         cacheTrump.Add(userTrump);
         cacheTrump.Update();
     }
     var cacheSet = new PersonalCacheStruct<UserFunction>();
     UserFunction userFunction = cacheSet.FindKey(ContextUser.UserID, FunctionEnum.TrumpPractice);
     if (userFunction == null)
     {
         UserFunction function = new UserFunction()
         {
             FunEnum = FunctionEnum.TrumpPractice,
             UserID = ContextUser.UserID,
             CreateDate = DateTime.Now,
         };
         cacheSet.Add(function);
         cacheSet.Update();
     }
     var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
     if (userTrump.LiftNum > 0 && usergeneral != null)
     {
         usergeneral.RefreshMaxLife();
     }
     return true;
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:62,代码来源:Action1452.cs

示例11: HeroDailyRestrain

 /// <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 PersonalCacheStruct<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();
     }
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:40,代码来源:PlotHelper.cs


注:本文中的PersonalCacheStruct.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。