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


C# CacheList.Add方法代码示例

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


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

示例1: GetCaches

 public static Caches GetCaches()
 {
     Cache _cache = HttpRuntime.Cache;
     IDictionaryEnumerator cacheEnum = _cache.GetEnumerator();
     CacheList cl = new CacheList();
     cl = new CacheList();
     while (cacheEnum.MoveNext())
     {
         cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString()));
     }
     Caches rs = new Caches();
     rs.CacheList = new CacheList();
     cl.SortBy(CacheInfo.Columns.Key, true);
     rs.CacheList.AddRange(cl);
     rs.Total = cl.Count;
     return rs;
 }
开发者ID:TaylorLi,项目名称:WorkStudioEnhance,代码行数:17,代码来源:CacheManager.cs

示例2: 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

示例3: Main

        static void Main(string[] args)
        {
            try
            {
                var dict = new CacheList<int>();
                dict.Add(1);
                string js = dict.ToJson();
                var temp = js.ParseJson<CacheList<int>>();
                if(temp == null)
                {

                }
                GameServerListManager.Initialize();
                var server = new GameProxy();
                Console.WriteLine("Press Enter to exit...");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Main error:{0}", ex);
            }
        }
开发者ID:haiya,项目名称:Scut,代码行数:22,代码来源:Program.cs

示例4: TakeAction

        public override bool TakeAction()
        {
            var syntheList = new CacheList<SynthesisInfo>();
            var package = UserEnchant.Get(ContextUser.UserID);
            if (ops == 1)
            {
                UserEnchantInfo userEnchantinfo1 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID1);
                UserEnchantInfo userEnchantinfo2 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID2);
                if (userEnchantinfo1 == null || userEnchantinfo2 == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough;
                    return false;
                }

                if (userEnchantinfo1.EnchantLv >= GameConfigSet.MaxEnchantLv)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv;
                    return false;
                }
                int entExprience1 = 0;
                int entExprience2 = 0;
                EnchantInfo enchant1 = new ConfigCacheSet<EnchantInfo>().FindKey(userEnchantinfo1.EnchantID);
                EnchantInfo enchant2 = new ConfigCacheSet<EnchantInfo>().FindKey(userEnchantinfo2.EnchantID);
                if (enchant1 != null && enchant2 != null)
                {
                    entExprience1 = enchant1.Experience;
                    entExprience2 = enchant2.Experience;
                    if (userEnchantinfo1.EnchantLv > userEnchantinfo2.EnchantLv ||
                        (userEnchantinfo1.EnchantLv == userEnchantinfo2.EnchantLv &&
                            userEnchantinfo1.CurrExprience >= userEnchantinfo2.CurrExprience))
                    {
                        UpdateEnchant(userEnchantID1, userEnchantID2, entExprience2);
                        syntheList.Add(new SynthesisInfo() { DemandID = userEnchantinfo2.EnchantID, Num = userEnchantinfo2.CurrExprience });
                        UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo1, syntheList);
                    }
                    else
                    {
                        UpdateEnchant(userEnchantID2, userEnchantID1, entExprience1);
                        syntheList.Add(new SynthesisInfo() { DemandID = userEnchantinfo1.EnchantID, Num = userEnchantinfo1.CurrExprience });
                        UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo2, syntheList);
                    }
                }
            }
            else if (ops == 2)
            {
                int experience = 0;
                var enchantArray = package.EnchantPackage.FindAll(m => string.IsNullOrEmpty(m.UserItemID));
                if (enchantArray.Count == 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough;
                    return false;
                }
                if (enchantArray.Count == 1)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_EnchantNumNotEnough;
                    return false;
                }
                enchantArray.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;
                    result = y.EnchantLv.CompareTo(x.EnchantLv);
                    if (result == 0)
                    {
                        result = y.CurrExprience.CompareTo(x.CurrExprience);
                    }
                    return result;
                });

                UserEnchantInfo uEnchantInfo =
                    package.EnchantPackage.Find(m => m.UserEnchantID == enchantArray[0].UserEnchantID);
                if (uEnchantInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1262_EnchantSynthesisNotEnough;
                    return false;
                }
                EnchantLvInfo enchantLvInfo = new ConfigCacheSet<EnchantLvInfo>().FindKey(uEnchantInfo.EnchantID,
                                                                                          GameConfigSet.MaxEnchantLv);
                int maxExprience = enchantLvInfo == null ? 0 : enchantLvInfo.Experience;

                foreach (var info in enchantArray)
                {
                    EnchantInfo enchantInfo = new ConfigCacheSet<EnchantInfo>().FindKey(info.EnchantID);
                    if (enchantInfo != null)
                    {
                        experience = enchantInfo.Experience;
                    }
                    if (uEnchantInfo.UserEnchantID != info.UserEnchantID)
                    {
                        if (uEnchantInfo.CurrExprience >= maxExprience)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv;
//.........这里部分代码省略.........
开发者ID:jinfei426,项目名称:Scut,代码行数:101,代码来源:Action1256.cs

示例5: SetRandomItem

        private static void SetRandomItem(CacheList<MysteryShops> mysteryList, List<ItemType> itemList, DateTime nextDate)
        {
            foreach (ItemType itemType in itemList)
            {
                List<ItemBaseInfo> itemArray = new ConfigCacheSet<ItemBaseInfo>().FindAll(u => u.IsMystery == 1 && u.ItemType == itemType);
                if (itemArray.Count == 0)
                {
                    throw new Exception("刷新神秘商店出错:物品" + itemType + "类型不存在");
                }
                ItemBaseInfo itemInfo = itemArray[RandomUtils.GetRandom(0, itemArray.Count)];

                if (mysteryList.Exists(m => m.ItemID == itemInfo.ItemID))
                {
                    itemArray = new ConfigCacheSet<ItemBaseInfo>().FindAll(u => u.IsMystery == 1 && u.ItemID != itemInfo.ItemID && u.ItemType == itemType);
                    if (itemArray.Count == 0)
                    {
                        throw new Exception("刷新神秘商店出错:物品" + itemType + "类型不存在");
                    }
                    itemInfo = itemArray[RandomUtils.GetRandom(0, itemArray.Count)];
                }

                mysteryList.Add(new MysteryShops() { ItemID = itemInfo.ItemID, NextDate = nextDate, BuyNum = 0, ItemNum = itemInfo.MysteryNum });

            }
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:25,代码来源:UserHelper.cs

示例6: GetApply

        /// <summary>
        /// 晋级公会
        /// </summary>
        /// <returns></returns>
        public static ServerFight[] GetApply(FightStage stage, int cityID)
        {
            int fastID = info.FastID;
            FightStage fightStage = FightStage.Ready;
            if (stage == FightStage.Apply && info.FastID > 1)
            {
                fastID = MathUtils.Subtraction(fastID, 1);
                fightStage = FightStage.final;
            }
            if (stage == FightStage.semi_Wait)
            {
                fightStage = FightStage.quarter_final;
            }
            else if (stage == FightStage.final_Wait)
            {
                fightStage = FightStage.semi_final;
            }
            var fightGroupList = new ShareCacheStruct<ServerFightGroup>().FindAll(s => s.FastID == fastID && s.Stage == fightStage);
            foreach (var fightgroup in fightGroupList)
            {
                if (string.IsNullOrEmpty(fightgroup.WinGuildID))
                {
                    ServerFightGroupWinGuildID(fightgroup, fastID);
                }
            }

            var applyList = new ShareCacheStruct<ServerFight>().FindAll(s => s.FastID == info.FastID && s.Stage == stage && s.CityID == cityID);
            applyList.QuickSort((x, y) =>
            {
                int result;
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;
                result = (int)y.GetResult(stage).CompareTo(x.GetResult(stage));
                if (result == 0)
                {
                    var userGuildA = new ShareCacheStruct<UserGuild>().FindKey(x.GuildID);
                    var userGuildB = new ShareCacheStruct<UserGuild>().FindKey(y.GuildID);
                    if (userGuildA != null && userGuildB != null)
                    {
                        result = userGuildB.GuildLv.CompareTo(userGuildA.GuildLv);
                        if (result == 0)
                        {
                            result = userGuildB.CurrExperience.CompareTo(userGuildA.CurrExperience);
                        }
                    }
                }
                return result;
            });

            var apply = new CacheList<ServerFight>();
            for (int i = 0; i < info.Lenght && i < applyList.Count; i++)
            {
                apply.Add(applyList[i]);
            }
            return apply.ToArray();
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:61,代码来源:GuildFightCombat.cs

示例7: DoPlotPrize

        /// <summary>
        /// 副本奖励,如果通关下发通关奖励
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="plotNpcInfo"></param>
        /// <param name="userPlotCombat"></param>
        internal static void DoPlotPrize(string userID, PlotNPCInfo plotNpcInfo, UserPlotCombat userPlotCombat, int npcGeneralNum, out int honourNum)
        {
            honourNum = 0;
            int experience = 0;
            PlotInfo plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(plotNpcInfo.PlotID);
            var package = UserPlotPackage.Get(userID);
            if (plotInfo == null || plotNpcInfo == null || userPlotCombat == null || package == null)
            {
                return;
            }

            GameUser user = new GameDataCacheSet<GameUser>().FindKey(userID);

            if (user != null)
            {

                experience += plotNpcInfo.Experience;
                userPlotCombat.Experience = plotNpcInfo.Experience;
                if (!string.IsNullOrEmpty(user.MercenariesID))
                {
                    //公会技能加成
                    userPlotCombat.Experience = MathUtils.RoundCustom(experience * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.Experience)).ToInt();
                    experience = userPlotCombat.Experience;
                }
                var cacheSetGeneral = new GameDataCacheSet<UserGeneral>();
                var userMagic = new GameDataCacheSet<UserMagic>().Find(user.UserID, s => s.IsEnabled);
                int userMagicID = userMagic == null ? 0 : userMagic.MagicID;
                var userEmbattleList = new GameDataCacheSet<UserEmbattle>().FindAll(userID, s => s.MagicID == userMagicID && s.GeneralID > 0);
                int generalNum = 0;
                userEmbattleList.ForEach(userEmbattle =>
                {
                    var userGeneral = cacheSetGeneral.FindKey(userID, userEmbattle.GeneralID);
                    generalNum = userGeneral != null && userGeneral.LifeNum > 0
                                     ? MathUtils.Addition(generalNum, 1)
                                     : generalNum;
                });
                user.GeneralAllCount = MathUtils.Addition(user.GeneralAllCount, userPlotCombat.GeneralNum);
                user.GeneralKillCount = MathUtils.Addition(user.GeneralKillCount,
                                                           (userPlotCombat.GeneralNum - generalNum));
                //怪物掉落物品)
                if (plotNpcInfo.IsBoss)
                {

                    if (plotInfo.PlotType == PlotType.Normal && user.PlotProgress < plotInfo.PlotID)
                    {
                        user.PlotProgress = plotInfo.PlotID;
                    }

                    //日常任务-通关副本
                    TaskHelper.TriggerDailyTask(userID, 4005);

                    DateTime currDate = DateTime.Now;
                    //通关奖励

                    var userPlot = UserPlotHelper.GetUserPlotInfo(userID, plotNpcInfo.PlotID);
                    if (userPlot == null)
                    {
                        userPlot = new UserPlotInfo();
                        userPlot.PlotID = plotNpcInfo.PlotID;
                        userPlot.CreateDate = currDate;
                        package.SaveItem(userPlot);
                    }

                    NoviceHelper.PlotFestivalList(user, plotInfo.PlotID); //活动集合
                    List<UserPlotCombat> preUserPlotList = new GameDataCacheSet<UserPlotCombat>().FindAll(userID, m => !m.PlotNpcID.Equals(userPlotCombat.PlotNpcID) && m.PlotID == plotNpcInfo.PlotID);
                    preUserPlotList.Add(userPlotCombat);
                    List<UserPlotCombat> plotCombatList = preUserPlotList;
                    short starScore;
                    PlotSuccessType plotSuccessType = PlotSuccessType.No;
                    userPlot.ScoreNum = GetPlotScoreNum(plotCombatList, out starScore);

                    userPlot.PlotStatus = PlotStatus.Completed;
                    userPlot.AttackScore = 0;
                    userPlot.DefenseScore = 0;
                    userPlot.ItemID = 0;
                    userPlot.EnchantID = 0;

                    userPlot.PlotSuccessType = plotSuccessType;
                    //获得星星等级
                    if (userPlotCombat.IsWin)
                    {
                        double pren = 0;
                        GetStar(user, generalNum, out starScore, out plotSuccessType, out  pren);
                        userPlot.StarScore = starScore;
                        userPlot.PlotSuccessType = plotSuccessType;
                        //获得荣誉值
                        honourNum = plotInfo.HonourNum;

                        userPlot.PlotNum = MathUtils.Addition(userPlot.PlotNum, 1);
                        if (GetPlotChallengeNum(userID, plotNpcInfo.PlotID) == 1)
                        {
                            if (starScore >= 3)
                            {
                                if (plotInfo.PlotType==PlotType.Elite)  // 如果是精英副本
//.........这里部分代码省略.........
开发者ID:0jpq0,项目名称:Scut,代码行数:101,代码来源:PlotHelper.cs

示例8: 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

示例9: 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

示例10: 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

示例11: SetEmbattle

 private void SetEmbattle(EmbattleQueue combatGrid, CacheList<CombatEmbattle> list)
 {
     IGeneral[] generalList = combatGrid.FindAll(true);
     foreach (IGeneral general in generalList)
     {
         if (general != null && general is CombatGeneral)
         {
             CombatGeneral cgeneral = (CombatGeneral)general;
             list.Add(new CombatEmbattle
             {
                 UserID = cgeneral.UserID,
                 GeneralID = cgeneral.GeneralID,
                 GeneralName = cgeneral.GeneralName,
                 GeneralLv = cgeneral.Lv,
                 HeadID = cgeneral.HeadID,
                 AbilityID = cgeneral.TempAbility == null ? 0 : cgeneral.TempAbility.AbilityID,
                 LiveNum = cgeneral.LifeNum,
                 LiveMaxNum = cgeneral.LifeMaxNum,
                 MomentumNum = cgeneral.Momentum,
                 MaxMomentumNum = CombatGeneral.MomentumOut,
                 Position = cgeneral.Position,
                 IsWait = cgeneral.IsWait,
                 BattleHead =  cgeneral.BattleHeadID
             });
         }
     }
     if (list.Count == 0)
     {
         new BaseLog().SaveDebugLog("战斗异常,未能加载佣兵数据");
     }
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:31,代码来源:PlotCombat.cs

示例12: TakeAction


//.........这里部分代码省略.........
                    #region 普通合成
                    if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv < 4)
                    {
                        ErrorCode = 3;
                        ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough;
                        return false;
                    }
                    if (!GetMaterialsNum(ContextUser.UserID, synthesisInfo.ItemID) && ContextUser.VipLv >= 4)
                    {
                        ErrorCode = 2;
                        ErrorInfo = LanguageManager.GetLang().St1603_MaterialsNotEnough + "," + string.Format(LanguageManager.GetLang().St1603_SynthesisEnergyNum, useGold);
                        return false;
                    }
                    foreach (ItemSynthesisInfo synthesis in synthesisArray)
                    {
                        ItemBaseInfo itemsInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(synthesis.SynthesisID);
                        if (itemInfo == null) return false;
                        if (!string.IsNullOrEmpty(_userEquID) && synthesis.SynthesisID == userItem.ItemID && itemsInfo != null && itemInfo.ItemType == ItemType.ZhuangBei)
                        {
                            if (userItem.ItemStatus == ItemStatus.YongBing)
                            {
                                //if (UserHelper.IsItemEquSpare(ContextUser, userItem.UserItemID))
                                //{
                                //    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                //    ErrorInfo = LanguageManager.GetLang().St_ItemEquIndexOfSpare;
                                //    return false;
                                //}
                                if (IsLevelNotEnough(ContextUser, userItem.GeneralID, synthesisInfo.ItemID))
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                                    return false;
                                }
                                UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 9, userItem.UserItemID);
                                synthesisInfoList.Add(new SynthesisInfo() { DemandID = userItem.ItemID, Num = 1 });
                                //package.SyncCache(() =>
                                //{
                                //    userItem.IsRemove = true;
                                //    package.ItemPackage.Remove(userItem);
                                //    package.DelayChange();
                                //});
                            }
                        }
                        else
                        {
                            if (itemsInfo != null && itemsInfo.ItemType == ItemType.ZhuangBei)
                            {
                                synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID);
                                if (IsLevelNotEnough(ContextUser, synthesisUserItem.GeneralID, synthesisInfo.ItemID))
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St_LevelNotEnough;
                                    return false;
                                }
                                //synthesisUserItem = GetUserItemInfo(ContextUser.UserID, itemsInfo.ItemID);
                            }
                            else
                            {
                                synthesisInfoList.Add(new SynthesisInfo() { DemandID = synthesis.SynthesisID, Num = synthesis.DemandNum });
                                UserItemHelper.UseUserItem(ContextUser.UserID, synthesis.SynthesisID, synthesis.DemandNum);
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(_userEquID))
                    {
                        itemLv = MathUtils.Subtraction(userItem.ItemLv, (short)5, (short)1);
开发者ID:0jpq0,项目名称:Scut,代码行数:67,代码来源:Action1603.cs

示例13: DrawWatch

            private void DrawWatch(MyListDictionary<MemberInfo, MemberInfo> watch)
            {
                PlotHistory();
                if (watch == null)
                    return;
                List<object> log = new CacheList<object>(watch.Values.Count);

                StringBuilder sb = new StringBuilder();
                Vector2 pos = new Vector2(100, 50);// m_counter * 0.2f);

                int i = -1;
                foreach (var list in watch.Values)
                {
                    i++;
                    if(i < SelectedMember)
                        continue;
                    object currentInstance = SelectedEntity;
                    foreach (var member in list)
                    {
                        sb.Append(".");
                        sb.Append(member.Name);
                        currentInstance = member.GetValue(currentInstance);
                    }
                    sb.Append(":");
                    sb.Append(currentInstance.ToString());
                    MyRenderProxy.DebugDrawText2D(pos, sb.ToString(),
                        m_toPlot.Contains(i) ? m_colors[i] : Color.White, 0.55f);
                    pos.Y += 12;
                    sb.Clear();
                    log.Add(currentInstance);
                }
                pos.X = 90;
                foreach (var toPlot in m_toPlot)
                {
                    int idx = (toPlot - SelectedMember);
                    if (idx < 0)
                        continue;
                    pos.Y = 50 + idx * 12;
                    MyRenderProxy.DebugDrawText2D(pos, "*",
                       m_colors[toPlot], 0.55f);
                }
                m_history.Add(log);
                if(m_history.Count >= MAX_HISTORY)
                    m_history.RemoveAtFast(m_frame);
                m_frame++;
                m_frame %= MAX_HISTORY;
            }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:47,代码来源:MyHonzaInputComponent.LiveWatch.cs

示例14: GetCaches

 private static Caches GetCaches(bool isGetAll, int pageIndex, int pageSize, string sort, bool isAsc, string cacheKey, string cacheType)
 {
     Cache _cache = HttpRuntime.Cache;
     IDictionaryEnumerator cacheEnum = _cache.GetEnumerator();
     CacheList cl = new CacheList();
     cl = new CacheList();
     while (cacheEnum.MoveNext())
     {
         if (!string.IsNullOrEmpty(cacheKey) && cacheEnum.Key.ToString().ToUpper().IndexOf(cacheKey.ToUpper()) < 0) continue;
         if (!string.IsNullOrEmpty(cacheType) && cacheEnum.Value.GetType().ToString().ToUpper().IndexOf(cacheType.ToUpper()) < 0) continue;
         cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString()));
     }
     Caches rs = new Caches();
     rs.CacheList = new CacheList();
     if (isGetAll)
     {
         cl.SortBy(sort, isAsc);
         rs.CacheList.AddRange(cl);
     }
     else
         rs.CacheList.AddRange(cl.GetPaging(pageSize, pageIndex, sort, isAsc));
     rs.Total = cl.Count;
     return rs;
 }
开发者ID:TaylorLi,项目名称:WorkStudioEnhance,代码行数:24,代码来源:CacheManagerTemplatePage.cs

示例15: UpdateCrystal

        /// <summary>
        /// 合成水晶
        /// </summary>
        /// <param name="userCryStal1"></param>
        /// <param name="userCryStal2"></param>
        /// <param name="cryExprience2"></param>
        private void UpdateCrystal(string _userCrystalID1, string _userCrystalID2, int cryExprience2)
        {
            var package = UserCrystalPackage.Get(Uid);
            UserCrystalInfo userCryStalInfo1 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(_userCrystalID1));
            UserCrystalInfo userCryStalInfo2 = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(_userCrystalID2));
            CacheList<SynthesisInfo> SynList = new CacheList<SynthesisInfo>();
            SynList.Add(new SynthesisInfo() { DemandID = userCryStalInfo2.CrystalID, Num = userCryStalInfo2.CurrExprience });
            userCryStalInfo1.CurrExprience = MathUtils.Addition(userCryStalInfo1.CurrExprience, cryExprience2);
            userCryStalInfo1.CurrExprience = MathUtils.Addition(userCryStalInfo1.CurrExprience,userCryStalInfo2.CurrExprience);
            package.SaveCrystal(userCryStalInfo1);
            //package.DelayChange();
            UserHelper.CheckCrystalEscalate(ContextUser.UserID, userCryStalInfo1.UserCrystalID);
            UserLogHelper.AppenCtystalLog(ContextUser.UserID, 3, userCryStalInfo1.CrystalID, 0, 0, SynList, userCryStalInfo1.CrystalLv, userCryStalInfo1.CurrExprience);
            package.RemoveCrystal(userCryStalInfo2);

        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:22,代码来源:Action1308.cs


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