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


C# CacheList.Find方法代码示例

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


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

示例1: GuildFightCombatUserList

 public static void GuildFightCombatUserList()
 {
     _fightUserList = new CacheList<FightUser>();
     var fightList = new ShareCacheStruct<ServerFight>().FindAll(m => m.FastID == info.FastID);
     foreach (ServerFight fight in fightList)
     {
         if (string.IsNullOrEmpty(fight.CombatMember))
         {
             continue;
         }
         string[] strList = fight.CombatMember.Split(',');
         foreach (string s in strList)
         {
             if (string.IsNullOrEmpty(s))
             {
                 continue;
             }
             var FightStatusUser = _fightUserList.Find(m => !m.IsRemove && m.UserId == s);
             if (FightStatusUser != null)
             {
                 continue;
             }
             FightUser fightUser = new FightUser();
             fightUser.GuildID = fight.GuildID;
             fightUser.UserId = s;
             GameUser user = UserCacheGlobal.CheckLoadUser(s);
             if (user != null)
             {
                 fightUser.UserName = user.NickName;
                 user.UserStatus = UserStatus.FightCombat;
             }
             fightUser.WinCount = 0;
             fightUser.CityID = fight.CityID;
             fightUser.ObtainNum = 0;
             fightUser.InspirePercent = 0;
             fightUser.IsRemove = false;
             fightUser.IsNotEnough = false;
             _fightUserList.Add(fightUser);
         }
     }
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:41,代码来源:GuildFightCombat.cs

示例2: TakeAction

 public override bool TakeAction()
 {
     CacheList<GeneralHeritage> heritageList = new CacheList<GeneralHeritage>();
     GeneralHeritage heritage = new GeneralHeritage();
     UserGeneral general = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, generalID);
     if (general == null)
     {
         return false;
     }
     if (ContextUser.HeritageList.Count > 0)
     {
         heritageList = ContextUser.HeritageList;
         if (heritageList.Find(m => m.Type == heritageType) != null)
         {
             heritage = heritageList.Find(m => m.Type == heritageType);
         }
     }
     if (heritageType == HeritageType.Heritage)
     {
         int opsid = 0;
         OpsInfo opsInfo = GeneralHelper.HeritageOpsInfo(opsid);
         GeneralHeritage gHeritage = heritageList.Find(m => m.Type == HeritageType.IsHeritage);
         if (opsInfo != null)
         {
             short genlv = MathUtils.Addition(gHeritage == null ? 0.ToShort() : gHeritage.GeneralLv, 3.ToShort());
             if (gHeritage != null && general.GeneralLv < genlv)
             {
                 ErrorCode = LanguageManager.GetLang().ErrorCode;
                 ErrorInfo = LanguageManager.GetLang().St1418_HeritageLvLow;
                 return false;
             }
             ContextUser.HeritageList.Remove(heritage);
             heritage.GeneralID = generalID;
             heritage.Type = heritageType;
             heritage.GeneralLv = MathUtils.RoundCustom(heritage.GeneralLv * opsInfo.Num).ToShort();
             heritage.GeneralLv = general.GeneralLv;
             heritage.PowerNum = MathUtils.RoundCustom(heritage.PowerNum * opsInfo.Num).ToShort();
             if (heritage.PowerNum < general.TrainingPower)
             {
                 heritage.PowerNum = general.TrainingPower;
             }
             heritage.SoulNum = MathUtils.RoundCustom(heritage.SoulNum * opsInfo.Num).ToShort();
             if (heritage.SoulNum < general.SoulNum)
             {
                 heritage.SoulNum = general.TrainingSoul;
             }
             heritage.IntellectNum = MathUtils.RoundCustom(heritage.IntellectNum * opsInfo.Num).ToShort();
             if (heritage.IntellectNum < general.IntellectNum)
             {
                 heritage.IntellectNum = general.TrainingIntellect;
             }
             heritage.opsType = 1;
             ContextUser.HeritageList.Add(heritage);
         }
     }
     else if (heritageType == HeritageType.IsHeritage)
     {
         ContextUser.HeritageList = new CacheList<GeneralHeritage>();
         heritage.GeneralID = generalID;
         heritage.GeneralLv = general.GeneralLv;
         heritage.Type = heritageType;
         heritage.PowerNum = general.TrainingPower;
         heritage.SoulNum = general.TrainingSoul;
         heritage.IntellectNum = general.TrainingIntellect;
         ContextUser.HeritageList.Add(heritage);
     }
     return true;
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:68,代码来源:Action1418.cs

示例3: IsAbilityOpen

 /// <summary>
 /// 公会技能是否开启
 /// </summary>
 /// <param name="abilityList"></param>
 /// <param name="info"></param>
 /// <returns></returns>
 public static bool IsAbilityOpen(CacheList<GuildAbility> abilityList, GuildAbilityInfo info)
 {
     GuildAbility ability = abilityList.Find(m => m.ID == info.ID);
     if (ability != null)
     {
         return false;
     }
     //没有前提条件
     if (info.PreAbility.Count == 0 && info.PreAbilityLv.Length == 0)
     {
         return true;
     }
     bool result = true;
     for (int i = 0; i < info.PreAbility.Count; i++)
     {
         GuildAbility preAbi = abilityList.Find(m => m.ID.ToString() == info.PreAbility[i]);
         if (preAbi == null || preAbi.Lv < Convert.ToInt32(info.PreAbilityLv[i]))
         {
             return false;
         }
     }
     return result;
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:29,代码来源:UserHelper.cs

示例4: GetPlotMonsterItems

        public static CacheList<PrizeItemInfo> GetPlotMonsterItems(string userID, int plotNpcID)
        {
            CacheList<PrizeItemInfo> itemList = new CacheList<PrizeItemInfo>();
            GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
            if (userInfo != null)
            {
                int doubleitem = GetDouble(userID, plotNpcID);
                int multiple = FestivalHelper.DuplicateDropDouble(userID);
                List<PlotEmbattleInfo> embattleInfoList = new ConfigCacheSet<PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == plotNpcID);
                foreach (PlotEmbattleInfo embattleInfo in embattleInfoList)
                {
                    MonsterInfo monster = new ConfigCacheSet<MonsterInfo>().FindKey(embattleInfo.MonsterID);
                    if (monster == null)
                    {
                        continue;
                    }
                    //原因:活动类型修改
                    if (RandomUtils.IsHit(NoviceHelper.FestivalMultiple(monster.ItemProbability)))
                    //if (RandomUtils.IsHit(FestivalHelper.DuplicateDropDouble(userID, monster.ItemProbability)))
                    {
                        if (ItemBaseInfo.IsExist(monster.ItemID))
                        {
                            PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == monster.ItemID);
                            if (itemInfo == null)
                            {
                                itemInfo = new PrizeItemInfo
                                {
                                    Type = 0,
                                    ItemID = monster.ItemID,
                                    Num = 1 * doubleitem * multiple
                                };
                                itemList.Add(itemInfo);
                            }
                            else
                            {
                                itemInfo.Num += 1 * doubleitem * multiple;
                            }
                        }
                    }
                }

                foreach (var itemInfo in itemList)
                {
                    UserItemHelper.AddUserItem(userID, itemInfo.ItemID, itemInfo.Num);
                    CacheList<PrizeItemInfo> prizeItemInfos = new CacheList<PrizeItemInfo>();
                    prizeItemInfos.Add(new PrizeItemInfo() { Type = 0, ItemID = itemInfo.ItemID, Num = itemInfo.Num });

                    if (prizeItemInfos.Count > 0)
                    {
                        userInfo.UserExtend.UpdateNotify(obj =>
                            {
                                userInfo.UserExtend.ItemList = prizeItemInfos;
                                return true;
                            });
                        //userInfo.Update();
                    }
                }
            }
            return itemList;
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:60,代码来源:PlotHelper.cs

示例5: GetPrizeItems

        /// <summary>
        /// 扫荡副本
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="itemProbability"></param>
        /// <param name="itemRank"></param>
        /// <returns></returns>
        private static CacheList<PrizeItemInfo> GetPrizeItems(string userID, decimal itemProbability, string itemRank, int plotID, UserPlotInfo userPlot)
        {
            List<UniversalInfo> universalInfoList = new List<UniversalInfo>();
            var itemList = new CacheList<PrizeItemInfo>();

            string[] items = itemRank.Trim().Split(new[] { ',' });
            int count = items.Length + 1;
            int[] precent = new int[count];
            int precentNum = 0;
            for (int i = 0; i < count; i++)
            {
                if (i != (count - 1))
                {
                    var itemInfo = items[i].Split('=');
                    decimal prize = itemInfo[2].ToDecimal();
                    precent[i] = (prize * 1000).ToInt();
                    precentNum = MathUtils.Addition(precentNum, precent[i]);
                }
                else
                {
                    precent[i] = (1000 - precentNum);
                }
            }

            int index = RandomUtils.GetHitIndexByTH(precent);
            if (index != (count - 1))
            {
                int itemId = 0;
                int num = 0;
                if (items.Length > 1)
                {

                    itemId = items[index].Split('=')[0].ToInt();
                    num = items[index].Split('=')[1].ToInt();
                }
                else
                {
                    itemId = items[0].Split('=')[0].ToInt();
                    num = items[0].Split('=')[1].ToInt();
                }

                var itemBase = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemId);
                if (itemBase != null)
                {
                    PrizeItemInfo prizeItem = itemList.Find(m => m.ItemID == itemId);
                    if (prizeItem == null)
                    {
                        prizeItem = new PrizeItemInfo
                        {
                            Type = 0,
                            ItemID = itemId,
                            Num = num
                        };
                        itemList.Add(prizeItem);
                    }
                    else
                    {
                        prizeItem.Num += num;
                    }
                }

            }
            GameUser userInfo = new GameDataCacheSet<GameUser>().FindKey(userID);
            foreach (var itemInfo in itemList)
            {

                UserItemHelper.AddUserItem(userID, itemInfo.ItemID, itemInfo.Num, universalInfoList);
                if (userInfo != null)
                {
                    CacheList<PrizeItemInfo> prizeItemInfos = new CacheList<PrizeItemInfo>();
                    prizeItemInfos.Add(new PrizeItemInfo() { Type = 0, ItemID = itemInfo.ItemID, Num = itemInfo.Num });

                    if (prizeItemInfos.Count > 0)
                    {
                        userInfo.UserExtend.UpdateNotify(obj =>
                            {
                                userInfo.UserExtend.ItemList = prizeItemInfos;
                                return true;
                            });
                        //userInfo.Update();
                    }
                }
            }
            NoviceHelper.PlotFestivalList(userInfo, plotID); //活动集合

            if (universalInfoList.Count > 0)
            {
                foreach (var item in universalInfoList)
                {
                    if (userPlot.ItemList != null)
                    {
                        userPlot.ItemList.Add(item);
                    }
//.........这里部分代码省略.........
开发者ID:0jpq0,项目名称:Scut,代码行数:101,代码来源:PlotHelper.cs

示例6: GetKalpaplotSparePart

 /// <summary>
 /// 天地劫获取灵件
 /// </summary>
 /// <param name="userInfo"></param>
 /// <param name="itemList"></param>
 /// <param name="npcInfo"></param>
 /// <param name="chatService"></param>
 private static void GetKalpaplotSparePart(GameUser userInfo, CacheList<PrizeItemInfo> itemList, PlotNPCInfo npcInfo, TjxChatService chatService)
 {
     if (npcInfo != null && RandomUtils.IsHit(npcInfo.SparePartProbability))
     {
         SparePartInfo partInfo = new ConfigCacheSet<SparePartInfo>().FindKey(npcInfo.SparePartID);
         if (partInfo != null && SparePartInfo.IsExist(npcInfo.SparePartID))
         {
             UserSparePart sparePart = UserSparePart.GetRandom(npcInfo.SparePartID);
             if (sparePart != null)
             {
                 PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == npcInfo.SparePartID);
                 if (itemInfo == null)
                 {
                     itemInfo = new PrizeItemInfo
                     {
                         Type = 1,
                         ItemID = npcInfo.SparePartID,
                         Num = 1
                     };
                     itemList.Add(itemInfo);
                 }
                 else
                 {
                     itemInfo.Num += 1;
                 }
                 if (UserHelper.AddSparePart(userInfo, sparePart))
                 {
                     //userInfo.Update();
                 }
                 else
                 {
                     //掉落灵件
                     chatService.SystemSendWhisper(userInfo, string.Format(LanguageManager.GetLang().St4303_SparePartFalling, partInfo.Name));
                 }
             }
         }
     }
 }
开发者ID:0jpq0,项目名称:Scut,代码行数:45,代码来源:PlotHelper.cs

示例7: GetKalpaplotEnchant

 /// <summary>
 /// 天地劫获取附魔符
 /// </summary>
 /// <param name="userInfo"></param>
 /// <param name="itemList"></param>
 /// <param name="npcInfo"></param>
 /// <param name="chatService"></param>
 private static void GetKalpaplotEnchant(GameUser userInfo, CacheList<PrizeItemInfo> itemList, int plotID)
 {
     EnchantInfo enchantInfo = GetPrizeEnchant(userInfo.UserID, plotID);
     if (enchantInfo == null || enchantInfo.EnchantID == 0)
         return;
     PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == enchantInfo.EnchantID);
     if (itemInfo == null)
     {
         itemInfo = new PrizeItemInfo
                        {
                            Type = 2,
                            ItemID = enchantInfo.EnchantID,
                            Num = 1
                        };
         itemList.Add(itemInfo);
     }
     else
     {
         itemInfo.Num += 1;
     }
 }
开发者ID:0jpq0,项目名称:Scut,代码行数:28,代码来源:PlotHelper.cs

示例8: GetKalpaPrizeItems

        /// <summary>
        /// 通關副本掉落物品
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="itemProbability"></param>
        /// <param name="itemRank"></param>
        /// <returns></returns>
        private static CacheList<PrizeItemInfo> GetKalpaPrizeItems(string userID, decimal itemProbability, string itemRank, int plotID, UserPlotInfo userPlot)
        {
            var itemList = new CacheList<PrizeItemInfo>();
            PlotInfo plotInfo = new ShareCacheStruct<PlotInfo>().FindKey(plotID);
            if (plotInfo == null)
            {
                return itemList;
            }

            string[] items = itemRank.Trim().Split(new[] { ',' });
            int count = items.Length + 1;
            int[] precent = new int[count];
            int precentNum = 0;
            for (int i = 0; i < count; i++)
            {
                if (i != (count - 1))
                {
                    var itemInfo = items[i].Split('=');
                    decimal prize = itemInfo[2].ToDecimal();
                    precent[i] = (prize * 1000).ToInt();
                    precentNum = MathUtils.Addition(precentNum, precent[i]);
                }
                else
                {
                    precent[i] = (1000 - precentNum);
                }
            }

            int index = RandomUtils.GetHitIndexByTH(precent);
            if (plotInfo.PlotType != PlotType.Kalpa && index != (count - 1))
            {
                if (items.Length == 0)
                {
                    return itemList;
                }
                string[] itemArray = items[index].Split('=');
                if (itemArray.Length == 2)
                {
                    int itemId = itemArray[0].ToInt();
                    if (new ShareCacheStruct<ItemBaseInfo>().FindKey(itemId) != null)
                    {
                        PrizeItemInfo itemInfo = itemList.Find(m => m.ItemID == itemId);
                        if (itemInfo == null)
                        {
                            itemInfo = new PrizeItemInfo
                                           {
                                               Type = 0,
                                               ItemID = itemId,
                                               Num = itemArray[1].ToInt()
                                           };
                            itemList.Add(itemInfo);
                        }
                        else
                        {
                            itemInfo.Num += itemArray[1].ToInt();
                        }
                    }
                }
            }
            List<UniversalInfo> universalInfoList = new List<UniversalInfo>();
            GameUser userInfo = new PersonalCacheStruct<GameUser>().FindKey(userID);
            foreach (var itemInfo in itemList)
            {
                UserItemHelper.AddUserItem(userID, itemInfo.ItemID, itemInfo.Num, universalInfoList);
                if (userInfo != null)
                {
                    CacheList<PrizeItemInfo> prizeItemInfos = new CacheList<PrizeItemInfo>();
                    prizeItemInfos.Add(new PrizeItemInfo() { Type = 0, ItemID = itemInfo.ItemID, Num = itemInfo.Num });

                    if (prizeItemInfos.Count > 0)
                    {
                        userInfo.UserExtend.UpdateNotify(obj =>
                        {
                            userInfo.UserExtend.ItemList = prizeItemInfos;
                            return true;
                        });
                        //userInfo.Update();
                    }
                }
            }

            if (universalInfoList.Count > 0 && userPlot != null)
            {
                universalInfoList.ForEach(universalInfo =>
                {
                    userPlot.ItemList.Add(universalInfo);
                });
            }
            NoviceHelper.PlotFestivalList(userInfo, plotID); //活动集合
            GetKalpaplotEnchant(userInfo, itemList, plotID); //副本掉落附魔符
            return itemList;
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:99,代码来源:PlotHelper.cs


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