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


C# ConfigCacheSet.Find方法代码示例

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


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

示例1: AddGeneralSoul

 /// 获得灵魂
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="itemId"></param>
 /// <param name="num"></param>
 public static void AddGeneralSoul(string userId, int itemId, int num)
 {
     var cacheSetGeneral = new GameDataCacheSet<UserGeneral>();
     var cacheSetGeneralInfo = new ConfigCacheSet<GeneralInfo>();
     var generalInfo = cacheSetGeneralInfo.Find(s => s.SoulID == itemId);
     var userGeneral = cacheSetGeneral.FindKey(userId, itemId);
     if (userGeneral != null && generalInfo != null)
     {
         userGeneral.AtmanNum = MathUtils.Addition(userGeneral.AtmanNum, num).ToShort();
     }
     else
     {
         if (generalInfo != null)
         {
             userGeneral = new UserGeneral();
             userGeneral.UserID = userId;
             userGeneral.GeneralID = itemId;
             userGeneral.AtmanNum = num;
             userGeneral.GeneralName = generalInfo.GeneralName;
             userGeneral.HeadID = generalInfo.HeadID;
             userGeneral.PicturesID = generalInfo.PicturesID;
             userGeneral.GeneralLv = generalInfo.GeneralLv;
             userGeneral.LifeNum = generalInfo.LifeNum;
             userGeneral.GeneralType = generalInfo.GeneralType;
             userGeneral.CareerID = generalInfo.CareerID;
             userGeneral.PowerNum = generalInfo.PowerNum;
             userGeneral.SoulNum = generalInfo.SoulNum;
             userGeneral.IntellectNum = generalInfo.IntellectNum;
             userGeneral.TrainingPower = 0;
             userGeneral.TrainingSoul = 0;
             userGeneral.TrainingIntellect = 0;
             userGeneral.HitProbability = ConfigEnvSet.GetDecimal("Combat.HitiNum");
             userGeneral.AbilityID = generalInfo.AbilityID;
             userGeneral.Momentum = 0;
             userGeneral.Description = generalInfo.Description;
             userGeneral.AddGeneralStatus(2);
             userGeneral.CurrExperience = 0;
             userGeneral.Experience1 = 0;
             userGeneral.Experience2 = 0;
             userGeneral.AbilityNum = 3;
             cacheSetGeneral.Add(userGeneral);
         }
     }
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:49,代码来源:UserItemHelper.cs

示例2: TakeAction

        public override bool TakeAction()
        {
            short currMaxLv = ConfigEnvSet.GetInt("User.CurrMaxLv").ToShort();
            //NoviceHelper.CheckFestival(ContextUser);

            NoviceHelper.GetFunctionEnum(Uid); //默认开启金币,精力大作战功能
            if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
            {
                UserHelper.ChecheDailyContribution(ContextUser.MercenariesID, ContextUser.UserID);
            }
            PaymentService.Trigger(ContextUser);
            if (ContextUser.UserLv > currMaxLv)
            {
                genlv = currMaxLv;
            }
            else
            {
                genlv = ContextUser.UserLv;
            }
            var cacheSetGeneralEscalate = new ConfigCacheSet<GeneralEscalateInfo>();
            GeneralEscalateHelper.AddUserLv(ContextUser, 0);
            _honourNum = ContextUser.HonourNum;
            int lv = ContextUser.UserLv;
            lv = lv < 0 ? 1 : lv + 1;
            var generalEscalate =
                cacheSetGeneralEscalate.Find(s => s.GeneralType == GeneralType.YongHu && s.GeneralLv == lv);
            if (generalEscalate != null)
            {
                _nextHonourNum = generalEscalate.UpExperience;
            }
            guildID = ContextUser.MercenariesID;
            var userGeneralList = new GameDataCacheSet<UserGeneral>().FindAll(ContextUser.UserID);
            if (userGeneralList.Count == 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }

            userGeneralInfo = userGeneralList[0]; //UserGeneral.GetMainGeneral(ContextUser.UserID);
            if (userGeneralInfo != null)
            {
                //wuzf 去掉刷新血量,其它改变血量接口有触发刷新
                //userGeneralInfo.RefreshMaxLife();
                generalID = userGeneralInfo.GeneralID;
                //careerInfo = new ConfigCacheSet<CareerInfo>().FindKey(userGeneralInfo.CareerID);
                headID = userGeneralInfo.HeadID; //ContextUser.Sex ? careerInfo.HeadID2 : careerInfo.HeadID;
                escalateInfo = new ConfigCacheSet<GeneralEscalateInfo>().FindKey(genlv);
                lifeNum = userGeneralInfo.LifeNum;
                careerID = userGeneralInfo.CareerID;
            }
            lifeMaxNum = UserHelper.GetMaxLife(ContextUser.UserID, generalID);
            maxEnergyNum = (short)ConfigEnvSet.GetInt("User.MaxEnergyNum");
            sex = ContextUser.Sex ? 1 : 0;

            //道具图标
            _blessingList = UserHelper.BlessingInfoList(ContextUser);
            //变身卡图标
            List<UserProps> userPropsList = new GameDataCacheSet<UserProps>().FindAll(ContextUser.UserID, u => u.PropType == 3 && u.ItemID != 5200 && u.ItemID != 7003);
            if (userPropsList.Count > 0)
            {
                UserProps props = userPropsList[0];
                int pTime = props.DoRefresh();
                ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(props.ItemID);
                if (itemInfo != null && pTime > pictureTime)
                {
                    pictureID = itemInfo.PictrueID;
                    pictureTime = pTime;
                }
            }
            //兼容客户端上已版本血量图标
            List<UserProps> userPropsList2 = new GameDataCacheSet<UserProps>().FindAll(ContextUser.UserID, u => u.PropType == 1);
            if (userPropsList2.Count > 0)
            {
                UserProps props = userPropsList2[0];
                int pTime = props.DoRefresh();
                ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(props.ItemID);
                if (itemInfo != null && pTime > pictureTime)
                {
                    _itemLiveNum = props.SurplusNum;
                    _itemLiveMaxNum = itemInfo.EffectNum;
                }
            }


            //加量,领土战不能加血wuzf)
            if (ContextUser.UserStatus != UserStatus.CountryCombat)
            {
                UserHelper.GetGeneralLife(ContextUser.UserID);
            }
          


            //精力恢复
            List<UserQueue> energyQueueArray = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.EnergyHuiFu);
            if (energyQueueArray.Count > 0)
            {
                UserQueue energyQueue = energyQueueArray[0];
                short energyMaxNum = (short)ConfigEnvSet.GetInt("User.MaxEnergyNum");
                int restorationDate = ConfigEnvSet.GetInt("UserQueue.EnergyRestorationDate"); //半小时
                int restorationNum = ConfigEnvSet.GetInt("UserQueue.EnergyRestorationNum"); //恢复5点
//.........这里部分代码省略.........
开发者ID:jinfei426,项目名称:Scut,代码行数:101,代码来源:Action1008.cs

示例3: TakeAction

        public override bool TakeAction()
        {
            PlotInfo plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(PlotID);
            if (plotInfo != null)
            {
                plotName = plotInfo.PlotName;
            }
            var cacheSetGeneralEscalate = new ConfigCacheSet<GeneralEscalateInfo>();
            GeneralEscalateHelper.AddUserLv(ContextUser, 0);
            int lv = ContextUser.UserLv;
            lv = lv < 0 ? 1 : lv + 1;
            var generalEscalate =
                cacheSetGeneralEscalate.Find(s => s.GeneralType == GeneralType.YongHu && s.GeneralLv == lv);
            if (generalEscalate != null)
            {
                maxHonourNum = generalEscalate.UpExperience;
            }
            var lastGeneralEscalate = cacheSetGeneralEscalate.Find(s => s.GeneralType == GeneralType.YongHu && s.GeneralLv == (lv-1));
            if (lastGeneralEscalate!=null)
            {
                lastMaxHonourNum = lastGeneralEscalate.UpExperience;
            }

            embattleList = new GameDataCacheSet<UserEmbattle>().FindAll(ContextUser.UserID, m => m.MagicID == ContextUser.UseMagicID);
            embattleList.QuickSort((x, y) => x.GeneralID.CompareTo(y.GeneralID));
            List<UniversalInfo> universalList = new List<UniversalInfo>();
            userPlot = UserPlotHelper.GetUserPlotInfo(ContextUser.UserID, PlotID);
            //var cacheSetPlotInfo = new ConfigCacheSet<PlotInfo>();
            //var cacheSetItem = new ConfigCacheSet<ItemBaseInfo>();
            //var plotInfo = cacheSetPlotInfo.FindKey(PlotID);

            if (userPlot != null && userPlot.ItemList.Count > 0)
            {
                universalList.AddRange(userPlot.ItemList);
                //if (plotInfo != null && userPlot.PlotStatus == PlotStatus.Completed && plotInfo.ItemRank != "" && plotInfo.ItemRank != null)
                //{
                //    var itemArray = plotInfo.ItemRank.Split(',');
                //    foreach (var s in itemArray)
                //    {
                //        int itemId = s.Split('=')[0].ToInt();
                //        var item = cacheSetItem.FindKey(itemId);
                //        if (item != null)
                //        {
                //            universalList.Add(new UniversalInfo() { Name = item.ItemName, HeadID = item.HeadID, Num = s.Split('=')[1].ToInt() });
                //        }
                //    }

                //}
                //if (userPlot.ItemID > 0)
                //{
                //    itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(userPlot.ItemID);
                //    if (itemInfo != null)
                //    {
                //        universalList.Add(new UniversalInfo() { Name = itemInfo.ItemName, HeadID = itemInfo.HeadID, Num = 1 });
                //    }
                //}
                //if (userPlot.EnchantID > 0)
                //{
                //    enchant = new ConfigCacheSet<EnchantInfo>().FindKey(userPlot.EnchantID);

                //    if (enchant != null)
                //    {
                //        universalList.Add(new UniversalInfo() { Name = enchant.EnchantName, HeadID = enchant.HeadID, Num = 1 });
                //    }
                //}
                userPlot.ItemList.Clear();
            }
            universalArray = universalList.ToArray();

           
            return true;
        }
开发者ID:jinfei426,项目名称:Scut,代码行数:72,代码来源:Action4003.cs


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