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


C# GameDataCacheSet.Find方法代码示例

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


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

示例1: GeneralSort

        public static void GeneralSort(string userId, List<UserGeneral> userGenerals)
        {
            if (userGenerals.Count > 0)
            {
                var _userMagicArray = new GameDataCacheSet<UserMagic>().FindAll(userId);

                var userMagic =
                    _userMagicArray.Find(
                        x => x.UserID == userId && x.MagicType == MagicType.MoFaZhen && x.IsEnabled == true);
                var userEmbattleInfo = new GameDataCacheSet<UserEmbattle>().FindAll(userId,
                                                                                    x =>
                                                                                    x.MagicID == userMagic.MagicID);
                if (userEmbattleInfo != null)
                {
                    userEmbattleInfo.ForEach(x =>
                                                 {
                                                     foreach (var userGeneral in userGenerals)
                                                     {
                                                         if (x.GeneralID == userGeneral.GeneralID)
                                                         {
                                                             userGeneral.Position = x.Position;
                                                         }
                                                     }
                                                 });
                }

                userGenerals.QuickSort((x, y) =>
                                           {
                                               int result = 0;
                                               if (x == null && y == null) return 0;
                                               if (x != null && y == null) return 1;
                                               if (x == null) return -1;
                                               // 1、是否上阵(出手先后) 2、品质高低 
                                               result = y.IsBattle.CompareTo(x.IsBattle);
                                               if (result == 0)
                                               {
                                                   result = x.Position.CompareTo(y.Position);
                                               }
                                               if (result == 0)
                                               {
                                                   result = y.GeneralQuality.CompareTo(x.GeneralQuality);
                                               }
                                               if (result == 0)
                                               {
                                                   result = x.GeneralID.CompareTo(y.GeneralID);
                                               }
                                               return result;
                                           });
            }
        }
开发者ID:jinfei426,项目名称:Scut,代码行数:50,代码来源:GeneralSortHelper.cs

示例2: TakeAction

        public override bool TakeAction()
        {
            string publicUserID = ContextUser.UserID;
            if (!string.IsNullOrEmpty(toUserID))
            {
                publicUserID = toUserID;
            }
            UserMagic userMagic = new GameDataCacheSet<UserMagic>().Find(publicUserID, s => s.IsEnabled);

            var cacheSetUserEmbattle = new GameDataCacheSet<UserEmbattle>();
            var userGeneralList = new List<UserGeneral>();
            switch (generalType)
            {
                case GeneralType.YongBing:

                    userGeneralList = new GameDataCacheSet<UserGeneral>().FindAll(publicUserID, u => u.GeneralType != GeneralType.Soul && u.GeneralStatus == GeneralStatus.DuiWuZhong);

                    break;
                case GeneralType.Soul:
                    userGeneralList = new GameDataCacheSet<UserGeneral>().FindAll(publicUserID, u => u.GeneralType == generalType && u.AtmanNum > 0 && u.GeneralStatus == GeneralStatus.DuiWuZhong);
                    break;
                case GeneralType.Battle:
                    userGeneralList = new GameDataCacheSet<UserGeneral>().FindAll(publicUserID, u => u.GeneralType != GeneralType.Soul && u.GeneralStatus == GeneralStatus.DuiWuZhong);
                    break;

            }
            foreach (var userGeneral in userGeneralList)
            {
                switch (generalType)
                {
                    case GeneralType.YongBing:
                        if (
                          cacheSetUserEmbattle.Find(publicUserID, s => s.MagicID == userMagic.MagicID && s.GeneralID == userGeneral.GeneralID) !=
                          null)
                        {
                            userGeneral.IsBattle = true;
                        }
                        else
                        {
                            userGeneral.IsBattle = false;
                        }
                        userGeneralArray.Add(userGeneral);
                        break;
                    case GeneralType.Soul:
                        userGeneralArray.Add(userGeneral);
                        break;
                    case GeneralType.Battle:

                        if (
                         cacheSetUserEmbattle.Find(publicUserID, s => s.MagicID == userMagic.MagicID && s.GeneralID == userGeneral.GeneralID) !=
                         null)
                        {
                            userGeneral.IsBattle = true;
                            userGeneralArray.Add(userGeneral);
                        }

                        break;
                }
            }

            // 佣兵排序
            GeneralSortHelper.GeneralSort(ContextUser.UserID, userGeneralArray);

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

示例3: TakeAction

        public override bool TakeAction()
        {
            int currMaxLv = GameConfigSet.CurrMaxLv;
            string lifeUserID = string.Empty;

            UserCrystalInfo[] userCrystalsArrray = new UserCrystalInfo[0];
            if (!string.IsNullOrEmpty(toUserID))
            {
                var packageCrystal = UserCrystalPackage.Get(toUserID);
                userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(toUserID, generalID);
                userCrystalsArrray = packageCrystal.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(generalID)).ToArray();
                var package = UserItemPackage.Get(toUserID);
                userItemArray = package.ItemPackage.FindAll(
                    u => !u.IsRemove && u.GeneralID.Equals(generalID) &&
                        u.ItemStatus == ItemStatus.YongBing);
                lifeUserID = toUserID;
            }
            else
            {
                var packageCrystal = UserCrystalPackage.Get(ContextUser.UserID);
                userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, generalID);
                userCrystalsArrray = packageCrystal.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(generalID)).ToArray();

                var package = UserItemPackage.Get(ContextUser.UserID);
                userItemArray = package.ItemPackage.FindAll(u => !u.IsRemove && u.GeneralID.Equals(generalID) && u.ItemStatus == ItemStatus.YongBing);
                lifeUserID = ContextUser.UserID;
            }
            UserCacheGlobal.LoadOffline(lifeUserID);
            GeneralInfo generalInfo = new ConfigCacheSet<GeneralInfo>().FindKey(generalID);
            generalQuality = generalInfo == null ? (short)0 : generalInfo.GeneralQuality;
            if (generalInfo != null && userGeneral != null)
            {
                description = generalInfo.Description;
                if (userGeneral.GeneralLv >= currMaxLv)
                {
                    genLv = (short)currMaxLv;
                    userGeneral.CurrExperience = 0;
                }
                else
                {
                    genLv = userGeneral.GeneralLv;
                }
                generalName = userGeneral.GeneralName;
                headID = userGeneral.HeadID;
                picturesID = userGeneral.PicturesID;
                _battleHeadId = generalInfo.BattleHeadID;
                _hitProbability = generalInfo.HitProbability;
                careerInfo = new ConfigCacheSet<CareerInfo>().FindKey(userGeneral.CareerID);
                GeneralEscalateInfo generalEscalate = new ConfigCacheSet<GeneralEscalateInfo>().FindKey(genLv);
                if (generalEscalate != null)
                {
                    currExperience = userGeneral.CurrExperience;
                    maxExperience = generalEscalate.UpExperience;
                }
                powerNum = MathUtils.Addition(userGeneral.PowerNum, userGeneral.TrainingPower, short.MaxValue);
                soulNum = MathUtils.Addition(userGeneral.SoulNum, userGeneral.TrainingSoul, short.MaxValue);
                intellectNum = MathUtils.Addition(userGeneral.IntellectNum, userGeneral.TrainingIntellect, short.MaxValue);
                if (!string.IsNullOrEmpty(ContextUser.MercenariesID) && generalID == LanguageManager.GetLang().GameUserGeneralID)
                {
                    //公会技能加成
                    powerNum = MathUtils.RoundCustom(powerNum * CombatHelper.GetGuildAbilityNum(ContextUser.UserID, GuildAbilityType.PowerNum)).ToShort();
                    soulNum = MathUtils.RoundCustom(soulNum * CombatHelper.GetGuildAbilityNum(ContextUser.UserID, GuildAbilityType.SoulNum)).ToShort();
                    intellectNum = MathUtils.RoundCustom(intellectNum * CombatHelper.GetGuildAbilityNum(ContextUser.UserID, GuildAbilityType.IntellectNum)).ToShort();
                }
                if (generalID == LanguageManager.GetLang().GameUserGeneralID)
                {
                    //法宝基础属性加成
                    powerNum = MathUtils.Addition(powerNum, TrumpAbilityAttack.TrumpPropertyNum(ContextUser.UserID, generalID, AbilityType.PowerNum));
                    soulNum = MathUtils.Addition(soulNum, TrumpAbilityAttack.TrumpPropertyNum(ContextUser.UserID, generalID, AbilityType.SoulNum));
                    intellectNum = MathUtils.Addition(intellectNum, TrumpAbilityAttack.TrumpPropertyNum(ContextUser.UserID, generalID, AbilityType.IntelligenceNum));

                    //法宝--技能属性转换获得的值
                    //法宝--技能属性转换获得的值
                    decimal trumpPower = TrumpAbilityAttack.ConversionPropertyNum(ContextUser.UserID, powerNum, soulNum, intellectNum, AbilityType.PowerNum);
                    decimal trumpsoul = TrumpAbilityAttack.ConversionPropertyNum(ContextUser.UserID, powerNum, soulNum, intellectNum, AbilityType.SoulNum);
                    decimal trumpintellect = TrumpAbilityAttack.ConversionPropertyNum(ContextUser.UserID, powerNum, soulNum, intellectNum, AbilityType.IntelligenceNum);
                    powerNum = MathUtils.Addition(trumpPower.ToShort(), powerNum);
                    soulNum = MathUtils.Addition(trumpsoul.ToShort(), soulNum);
                    intellectNum = MathUtils.Addition(trumpintellect.ToShort(), intellectNum);
                }
                lifeNum = userGeneral.LifeNum;
                lifeMaxNum = UserHelper.GetMaxLife(lifeUserID, generalID);
                genLv = userGeneral.GeneralLv;
                generalStatus = (short)userGeneral.GeneralStatus;

                talentAbility = userGeneral.AbilityID;
                _potential = userGeneral.Potential;
                _battleHeadID = generalInfo.BattleHeadID;
                //玩家佣兵职业名称
                userCareerName = careerInfo.CareerName;
            }
            else if (generalInfo != null)
            {
                genLv = 1;
                generalName = generalInfo.GeneralName;
                headID = generalInfo.HeadID;
                picturesID = generalInfo.PicturesID;
                _battleHeadId = generalInfo.BattleHeadID;
                careerInfo = new ConfigCacheSet<CareerInfo>().FindKey(generalInfo.CareerID);
                GeneralEscalateInfo generalEscalate = new ConfigCacheSet<GeneralEscalateInfo>().FindKey(genLv);
//.........这里部分代码省略.........
开发者ID:rongxiong,项目名称:Scut,代码行数:101,代码来源:Action1403.cs

示例4: UpdateRecruitColdTime

 /// <summary>
 /// 佣兵招募冷却时间
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="recruitRule"></param>
 /// <returns></returns>
 public static void UpdateRecruitColdTime(string userID, RecruitRule recruitRule)
 {
     QueueType queueType = QueueType.ShiLiTiaoYi;
     if (recruitRule.RecruitType == RecruitType.ShiLiTiaoYi.ToInt())
     {
         queueType = QueueType.ShiLiTiaoYi;
     }
     else if (recruitRule.RecruitType == RecruitType.BaiLiTiaoYi.ToInt())
     {
         queueType = QueueType.BaiLiTiaoYi;
     }
     else if (recruitRule.RecruitType == RecruitType.Golden.ToInt())
     {
         queueType = QueueType.Golden;
     }
     var cacheSet = new GameDataCacheSet<UserQueue>();
     UserQueue userQueue = cacheSet.Find(userID, s => s.QueueType == queueType);
     if (userQueue == null)
     {
         userQueue = new UserQueue();
         userQueue.QueueID = Guid.NewGuid().ToString();
         userQueue.UserID = userID;
         userQueue.QueueType = queueType;
         cacheSet.Add(userQueue, userID.ToInt());
     }
     userQueue.QueueName = queueType.ToString();
     userQueue.Timing = DateTime.Now;
     userQueue.TotalColdTime = recruitRule.CodeTime;
     userQueue.ColdTime = recruitRule.CodeTime;
     userQueue.StrengNum = 1;
     userQueue.IsSuspend = false;
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:38,代码来源:GeneralHelper.cs


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