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


C# GameDataCacheSet.FindKey方法代码示例

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


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

示例1: GeneralStatus

 /// <summary>
 /// 佣兵状态
 /// </summary>
 public GeneralStatus GeneralStatus(string userID)
 {
     var cacheSet = new GameDataCacheSet<UserGeneral>();
     if (cacheSet.FindKey(userID, _item.GeneralID) != null)
     {
         return _item.IsNotUsed ? Model.GeneralStatus.YinCang : cacheSet.FindKey(userID, _item.GeneralID).GeneralStatus;
     }
     return Model.GeneralStatus.YinCang;
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:12,代码来源:UserItemHelper.cs

示例2: SendAllowTask

        /// <summary>
        /// 下发任务
        /// </summary>
        /// <param name="user"></param>
        /// <param name="taskID"></param>
        public static List<UserTask> SendAllowTask(GameUser user, int taskID)
        {
            List<UserTask> userTaskList = new List<UserTask>();
            var cacheSet = new GameDataCacheSet<UserTask>();
            UserTask preTask = cacheSet.FindKey(user.UserID, taskID);
            if (taskID > 0 && preTask != null && (preTask.TaskState != TaskState.Close || preTask.TaskType == TaskType.Offset))
            {
                return userTaskList;
            }
            if (taskID == 0 && cacheSet.FindAll(user.UserID, m => m.TaskType < TaskType.Daily).Count > 0)
            {
                return userTaskList;
            }

            IList<StoryTaskInfo> taskList = StoryTaskInfo.GetNextTask(taskID);
            bool isSend = true;
            foreach (StoryTaskInfo taskInfo in taskList)
            {
                if (taskInfo.CountryID != CountryType.None && user.CountryID != taskInfo.CountryID)
                {
                    continue;
                }
                UserTask userTask = cacheSet.FindKey(user.UserID, taskInfo.TaskID);
                if (userTask == null)
                {
                    userTask = new UserTask
                    {
                        TaskID = taskInfo.TaskID,
                        UserID = user.UserID,
                        TaskType = taskInfo.TaskType,
                        TaskState = taskInfo.TaskLv <= user.UserLv ? TaskState.AllowTake : TaskState.NoTake,
                        CompleteNum = 0,
                        CreateDate = DateTime.Now
                    };
                    cacheSet.Add(userTask);
                    userTask = cacheSet.FindKey(user.UserID, taskInfo.TaskID);
                    userTaskList.Add(userTask);
                }
                else
                {
                    //判断是否已下发过
                    isSend = false;
                    break;
                }
            }
            if (isSend)
            {
                return userTaskList;
            }
            return new List<UserTask>();
        }
开发者ID:jinfei426,项目名称:Scut,代码行数:56,代码来源:TaskHelper.cs

示例3: HeroRefreshNum

 /// <summary>
 /// 增加刷新次数
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="cityID"></param>
 /// <returns></returns>
 public static void HeroRefreshNum(string userID, int cityID)
 {
     var cacheSet = new GameDataCacheSet<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:0jpq0,项目名称:Scut,代码行数:36,代码来源:Action4014.cs

示例4: ProcessCmd

        protected override void ProcessCmd(string[] args)
        {
            int magicID = args.Length > 0 ? args[0].Trim().ToInt() : 0;
            short magicLv = args.Length > 1 ? args[1].Trim().ToShort() : (short)1;

            var cacheSet = new GameDataCacheSet<UserMagic>();
            var userMagic = cacheSet.FindKey(UserID, magicID);
            MagicInfo magic = new ConfigCacheSet<MagicInfo>().FindKey(magicID);
            if (magic == null)
            {
                return;
            }
            if (userMagic == null)
            {
                userMagic = new UserMagic()
                {
                    UserID = UserID,
                    MagicID = magicID,
                    MagicLv = magicLv,
                    IsEnabled = false,
                    MagicType = magic.MagicType,
                };
                cacheSet.Add(userMagic);
            }
            else
            {
                userMagic.MagicLv = magicLv;
            }
        }
开发者ID:jinfei426,项目名称:Scut,代码行数:29,代码来源:MagicCommand.cs

示例5: TakeAction

 public override bool TakeAction()
 {
     int useGold = ConfigEnvSet.GetInt("TrumpZodiac.ChangeZodiacUseGold");
     if (ops == 1)
     {
         ErrorCode = ops;
         ErrorInfo = string.Format(LanguageManager.GetLang().St1471_ChangeZodiac, useGold);
         return false;
     }
     else if (ops == 2)
     {
         if (ContextUser.GoldNum < useGold)
         {
             ErrorCode = LanguageManager.GetLang().ErrorCode;
             ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
             return false;
         }
         var cacheSet = new GameDataCacheSet<UserTrump>();
         UserTrump userTrump = cacheSet.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
         if (userTrump != null)
         {
             userTrump.Zodiac = TrumpHelper.GetZodiacType(userTrump.Zodiac);
             ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue);
         }
         ErrorCode = ops;
     }
     return true;
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:28,代码来源:Action1471.cs

示例6: TakeAction

        public override bool TakeAction()
        {
            var cacheSet = new GameDataCacheSet<GameUser>();

            GameUser user = cacheSet.FindKey(_useridreq);
            if (null != user)
            {
                if ((user.UserName != _username)
                    || (user.UserType != _usertype))
                {
                    return false;
                }

                /*更新客户端上报的存档信息*/
                user.ClientArchive = _clientarchive;

                cacheSet.Add(user);
                cacheSet.Update();

                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:wenhulove333,项目名称:ScutServer,代码行数:26,代码来源:Action1001.cs

示例7: Process

 private void Process(string userID, int generalID, int experience)
 {
     var cacheSet = new GameDataCacheSet<UserGeneral>();
     var usergeneral = cacheSet.FindKey(userID, generalID);
     if(usergeneral!=null)
     {
         usergeneral.CurrExperience = MathUtils.Addition(usergeneral.CurrExperience, experience);
     }
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:9,代码来源:ExperienceCommand.cs

示例8: TakeAction

        public override bool TakeAction()
        {

            int upitemNum = 0;
            var cacheSet = new GameDataCacheSet<UserTrump>();
            UserTrump userTrump = cacheSet.FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
            if (userTrump == null)
            {
                return false;
            }
            WashConsumeInfo consumeInfo = TrumpHelper.GetWashConsumeInfo(userTrump.MatureNum);
            if (consumeInfo == null)
            {
                return false;
            }
            upitemNum = TrumpHelper.GetUserItemNum(ContextUser.UserID, consumeInfo.ItemID);
            if (ops == 1)
            {
                string success = ((double)consumeInfo.SuccessNum * 100).ToString();
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St1458_UseBackDaysOrb, consumeInfo.ItemNum, consumeInfo.MatureNum, success);
                return false;
            }
            else if (ops == 2)
            {
                ErrorCode = ops;
                if (upitemNum < consumeInfo.ItemNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1458_BackDaysOrbNotEnough;
                    return false;
                }
                int maxMatrueNum = ConfigEnvSet.GetInt("Trump.MaxMatrueNum");
                if (userTrump.MatureNum >= maxMatrueNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1458_MaxMatrueNumFull;
                    return false;
                }
                UserItemHelper.UseUserItem(ContextUser.UserID, consumeInfo.ItemID, consumeInfo.ItemNum);
                if (RandomUtils.IsHit(consumeInfo.SuccessNum))
                {
                    userTrump.MatureNum = MathUtils.Addition(userTrump.MatureNum, consumeInfo.MatureNum.ToShort(), maxMatrueNum.ToShort());
                    ErrorInfo = LanguageManager.GetLang().St1458_XiLianSuccess;
                    var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
                    if (usergeneral != null)
                    {
                        usergeneral.RefreshMaxLife();
                    }
                }
                else
                {
                    ErrorInfo = LanguageManager.GetLang().St1458_XiLianFail;
                }
            }
            return true;
        }
开发者ID:jinfei426,项目名称:Scut,代码行数:57,代码来源:Action1458.cs

示例9: GetUserFunction

 /// <summary>
 /// 已开启的功能
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="funEnum"></param>
 /// <returns></returns>
 private static UserFunction GetUserFunction(string userID, FunctionEnum funEnum)
 {
     var cacheSet = new GameDataCacheSet<UserFunction>();
     UserFunction function1 = cacheSet.FindKey(userID, funEnum);
     if (function1 != null)
     {
         return function1;
     }
     return null;
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:16,代码来源:ViewHelper.cs

示例10: Get

 /// <summary>
 /// 背包
 /// </summary>
 /// <returns></returns>
 public UserItemPackage Get()
 {
     var cacheSet = new GameDataCacheSet<UserItemPackage>();
     var data = cacheSet.FindKey(_user.UserId.ToString());
     if (data != null)
     {
         return data;
     }
     TraceLog.WriteError(string.Format("User:{0} item package is null.", _user.UserId));
     return null;
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:15,代码来源:GameHall.cs

示例11: GetTask

 /// <summary>
 /// 玩家任务
 /// </summary>
 /// <returns></returns>
 public static UserTask GetTask(string userID)
 {
     var cacheSet = new GameDataCacheSet<UserTask>();
     var data = cacheSet.FindKey(userID);
     if (data != null)
     {
         return data;
     }
     TraceLog.WriteError(string.Format("User:{0} Task package is null.", userID));
     return null;
 }
开发者ID:87170360,项目名称:Maximus,代码行数:15,代码来源:AchieveTask.cs

示例12: AddBack

        /// <summary>
        /// 初始化背包
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static void AddBack(GameUser user)
        {
            var cacheSet = new GameDataCacheSet<UserPack>();
            var cacheSetBackPack = new ConfigCacheSet<BackpackConfigInfo>();
            var userPack = cacheSet.FindKey(user.UserID);

            if (userPack == null)
            {
                userPack = new UserPack();

                userPack.UserID = user.UserID.ToInt();
                userPack.CreateDate = DateTime.Now;
                var backpackConfig = cacheSetBackPack.FindKey(BackpackType.ZhuangBei);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.ZhuangBei;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                }

                backpackConfig = cacheSetBackPack.FindKey(BackpackType.YongBing);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.YongBing;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                }

                backpackConfig = cacheSetBackPack.FindKey(BackpackType.HunJi);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.HunJi;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                }

                backpackConfig = cacheSetBackPack.FindKey(BackpackType.BeiBao);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.BeiBao;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                    user.GridNum = MathUtils.Addition(user.GridNum, backpackConfig.DefaultNum);
                }
            }

        }
开发者ID:jinfei426,项目名称:Scut,代码行数:56,代码来源:BackPackHelper.cs

示例13: CheckLoadUser

 public static GameUser CheckLoadUser(string userId)
 {
     var cacheSet = new GameDataCacheSet<GameUser>();
     GameUser gameUser = cacheSet.FindKey(userId);
     if (gameUser == null)
     {
         //bool isAuto = true;
         //bool ignoreError = true;
         //int periodTime = GameEnvironment.CacheUserPeriod;
         //todo 注释掉,由底层自动加载
         //GameLoadManager.Add(new GameUserDataLoader<GameUser>(isAuto, "UserID", userId.ToInt(), 1, periodTime), ignoreError);
         //GameLoadManager.Add(new GameUserDataLoader<UserGeneral>(isAuto, "UserID", userId.ToInt(), LoadMaxCount, periodTime), ignoreError);
     }
     return gameUser;
 }
开发者ID:wf15271760803,项目名称:Scut-samples,代码行数:15,代码来源:UserCacheGlobal.cs

示例14: Get

 public static UserPlotPackage Get(string userId)
 {
     if (string.IsNullOrEmpty(userId))
     {
         throw new ArgumentNullException("UserID为空");
     }
     var cacheSet = new GameDataCacheSet<UserPlotPackage>();
     var data = cacheSet.FindKey(userId);
     if (data != null)
     {
         return data;
     }
     BaseLog log = new BaseLog();
     log.SaveLog(new NullReferenceException(string.Format("User:{0} UserPlot package is null.", userId)));
     return null;
 }
开发者ID:wf15271760803,项目名称:Scut-samples,代码行数:16,代码来源:UserPlotPackage.cs

示例15: Process

        private void Process(string userID, int fun)
        {
            FunctionEnum funEnum = fun.ToEnum<FunctionEnum>();

            var cacheSet = new GameDataCacheSet<UserFunction>();
            UserFunction userFunction = cacheSet.FindKey(UserID, funEnum);
            if (userFunction == null)
            {
                userFunction = new UserFunction()
                {
                    UserID = userID,
                    FunEnum = funEnum,
                    CreateDate = DateTime.Now
                };
                cacheSet.Add(userFunction, GameEnvironment.CacheUserPeriod);
            }
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:17,代码来源:FunctionCommand.cs


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