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


C# GameDataCacheSet.Delete方法代码示例

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


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

示例1: RemovePack

 /// <summary>
 ///  //删除不是本周,本月已领取的数据
 /// </summary>
 /// <param name="userID"></param>
 public static void RemovePack(string userID)
 {
     var cacheSet = new GameDataCacheSet<PackageReceive>();
     List<PackageReceive> packageReceiveArray = cacheSet.FindAll(userID, u => u.PacksType == 3 || u.PacksType == 4);
     foreach (PackageReceive packageReceive in packageReceiveArray)
     {
         if (!PaymentService.IsCurrentWeek(packageReceive.ReceiveDate) && packageReceive.PacksType == 3)
         {
             cacheSet.Delete(packageReceive);
         }
         if (packageReceive.ReceiveDate.Month != DateTime.Now.Month && packageReceive.PacksType == 4)
         {
             cacheSet.Delete(packageReceive);
         }
     }
 }
开发者ID:0jpq0,项目名称:Scut,代码行数:20,代码来源:Action9003.cs

示例2: TriggerWeekPack

        public static void TriggerWeekPack(string userID, int gameCoin)
        {
            int packType = 3;
            List<RechargePacks> rechargePackseArray = new ConfigCacheSet<RechargePacks>().FindAll(m => m.PacksType == packType);
            foreach (RechargePacks rechargePackse in rechargePackseArray)
            {
                if (rechargePackse.RechargeNum <= gameCoin)
                {
                    var packCacheSet = new GameDataCacheSet<PackageReceive>();
                    List<PackageReceive> packageReceivess = packCacheSet.FindAll(userID, m => m.PacksID == rechargePackse.PacksID);
                    if (packageReceivess.Count == 0)
                    {
                        PackageReceive receive = new PackageReceive();
                        receive.ReceiveID = Guid.NewGuid().ToString();
                        receive.PacksID = rechargePackse.PacksID;
                        receive.UserID = userID;
                        receive.IsReceive = false;
                        receive.ReceiveDate = DateTime.Now;
                        packCacheSet.Add(receive, GameEnvironment.CacheUserPeriod);
                    }
                    else if (!IsHaveWeek(packageReceivess))
                    {
                        PackageReceive receive = packageReceivess[0];

                        if (receive.IsReceive)
                        {
                            receive.IsReceive = false;
                            receive.ReceiveDate = DateTime.Now;
                            //receive.Update();
                        }
                        for (int i = 1; i <= packageReceivess.Count - 1; i++)
                        {
                            packCacheSet.Delete(packageReceivess[i]);
                        }
                    }
                }
            }
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:38,代码来源:PaymentService.cs

示例3: RemoveCharge

 /// <summary>
 /// 删除累计充值礼包多个,只余一个
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="packID"></param>
 /// <returns></returns>
 public static void RemoveCharge(string userID, int packID)
 {
     List<PackageReceive> packageReceiveArray = new GameDataCacheSet<PackageReceive>().FindAll(userID, m => m.PacksID == packID);
     if (packageReceiveArray.Count > 1)
     {
         var packCacheSet = new GameDataCacheSet<PackageReceive>();
         packageReceiveArray = packCacheSet.FindAll(userID, u => u.IsReceive && u.PacksID == packID);
         if (packageReceiveArray.Count > 0)
         {
             packageReceiveArray = packCacheSet.FindAll(userID, u => !u.IsReceive && u.PacksID == packID);
             foreach (PackageReceive packageReceive in packageReceiveArray)
             {
                 packCacheSet.Delete(packageReceive);
             }
         }
         else
         {
             packageReceiveArray = packCacheSet.FindAll(userID, u => !u.IsReceive && u.PacksID == packID);
             for (int i = 1; i <= packageReceiveArray.Count - 1; i++)
             {
                 packCacheSet.Delete(packageReceiveArray[i]);
             }
         }
     }
 }
开发者ID:0jpq0,项目名称:Scut,代码行数:31,代码来源:PaymentService.cs

示例4: UserGeneralPromptBlood

 /// <summary>
 /// 佣兵自动使用绷带补血
 /// </summary>
 public static void UserGeneralPromptBlood(GameUser user)
 {
     int subLifeNum = 0;
     if (IsPromptBlood(user.UserID))
     {
         var userItemArray = UserItemHelper.GetItems(user.UserID).FindAll(u => u.ItemType == ItemType.BengDai && u.ItemStatus != ItemStatus.Sell);
         if (userItemArray.Count > 0)
         {
             int itemID = userItemArray[0].ItemID;
             ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemID);
             var propsCacheSet = new GameDataCacheSet<UserProps>();
             List<UserProps> propsArray = propsCacheSet.FindAll(user.UserID, u => u.PropType == 1);
             if (propsArray.Count > 0 && propsArray[0].SurplusNum == 0)
             {
                 foreach (UserProps userPropse in propsArray)
                 {
                     if (userPropse.SurplusNum == 0)
                     {
                         propsCacheSet.Delete(userPropse);
                     }
                 }
             }
             //给佣兵补血
             List<UserGeneral> userGeneralArray = new GameDataCacheSet<UserGeneral>().FindAll(user.UserID, u => u.GeneralStatus == GeneralStatus.DuiWuZhong);
             int effectNum = itemInfo.EffectNum;
             foreach (var userGeneral in userGeneralArray)
             {
                 int maxLifeNum = GetMaxLife(user.UserID, userGeneral.GeneralID);
                 if (userGeneral.LifeNum < maxLifeNum)
                 {
                     subLifeNum = MathUtils.Subtraction(maxLifeNum, userGeneral.LifeNum, 0);
                     userGeneral.LifeNum = MathUtils.Addition(userGeneral.LifeNum, effectNum, maxLifeNum);
                     //userGeneral.Update();
                     effectNum = MathUtils.Subtraction(effectNum, subLifeNum, 0);
                 }
             }
             UserProps props = new UserProps(user.UserID, itemInfo.ItemID)
             {
                 SurplusNum = effectNum
             };
             propsCacheSet.Add(props, GameEnvironment.CacheUserPeriod);
             user.IsUseupItem = false;
             UserItemHelper.UseUserItem(user.UserID, itemInfo.ItemID, 1);
         }
     }
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:49,代码来源:UserHelper.cs

示例5: TakeAction

        public override bool TakeAction()
        {
            List<PlotNPCInfo> plotNPCInfoList = new ConfigCacheSet<PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
            npcCount = (short)plotNPCInfoList.Count;
            var cacheSet = new GameDataCacheSet<UserQueue>();
            List<UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);
            if (userQueueList.Count > 0)
            {
                UserQueue userQueue = userQueueList[0];
                coldTime = userQueue.DoRefresh();
                if (coldTime == 0)
                {
                    cacheSet.Delete(userQueue);
                    ContextUser.ResetSweepPool(0);
                    ContextUser.UserStatus = UserStatus.Normal;
                    //ContextUser.Update();
                }
                int tempNum = PlotHelper.GetBattleNum(userQueue.GetTiming()) + 1;
                if (npcCount > 0)
                {
                    turnsNum = PlotHelper.GetTurnsNum(npcCount, tempNum);
                    timesNum = PlotHelper.GetTimesNum(npcCount, tempNum);
                }
                //PlotHelper.CheckSweepCount(npcCount, userQueue.GetTiming(), out turnsNum, out battleNum);

                //if (battleNum >= npcCount)
                //{
                //    turnsNum = turnsNum + 1;
                //}
                //else
                //{
                //    battleNum = battleNum + 1;
                //}
            }
            userItemCount = (short)UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao).Count;
            plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(plotID);
            if (plotInfo == null)
            {
                return false;
            }
            foreach (PlotNPCInfo npcInfo in plotNPCInfoList)
            {
                if (npcInfo == null)
                {
                    continue;
                }
                List<PlotEmbattleInfo> embattleInfoList = new ConfigCacheSet<PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == npcInfo.PlotNpcID);
                foreach (PlotEmbattleInfo embattleInfo in embattleInfoList)
                {
                    if (monsterDict.ContainsKey(embattleInfo.MonsterID))
                    {
                        if (monsterNumDict.ContainsKey(embattleInfo.MonsterID))
                        {
                            monsterNumDict[embattleInfo.MonsterID] = monsterNumDict[embattleInfo.MonsterID] + 1;
                        }
                    }
                    else
                    {
                        MonsterInfo monsterInfo = new ConfigCacheSet<MonsterInfo>().FindKey(embattleInfo.MonsterID);
                        if (monsterInfo != null)
                        {
                            monsterDict.Add(embattleInfo.MonsterID, monsterInfo);
                            monsterNumDict.Add(embattleInfo.MonsterID, 1);
                        }
                    }
                }
            }
            return true;
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:69,代码来源:Action4006.cs

示例6: RefleshPrize

        /// <summary>
        /// 刷新副本奖励
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="plotID"></param>
        public static bool RefleshPrize(string userID, int plotID)
        {
            int turnsNum = 0;
            int battleNum = 0;

            List<UserQueue> queueList = new GameDataCacheSet<UserQueue>().FindAll(userID, m => m.QueueType == QueueType.SaoDang);
            if (queueList.Count == 0)
            {
                return false;
            }
            UserQueue saodangQueue = queueList[0];
            var npcList = new ConfigCacheSet<PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
            int npcCount = npcList.Count;
            GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(userID);

            while (HasSweep(userID, plotID, saodangQueue.GetTiming(), npcCount, out turnsNum, out battleNum))
            {
                int tempbattleNum = 0;
                if (gameUser.SweepPool.TurnsNum > 0)
                {
                    tempbattleNum = (gameUser.SweepPool.TurnsNum - 1) * npcCount + gameUser.SweepPool.BattleNum;
                }
                tempbattleNum += 1;
                turnsNum = GetTurnsNum(npcCount, tempbattleNum);
                battleNum = GetTimesNum(npcCount, tempbattleNum);
                DoPlotSweepPrize(userID, plotID, turnsNum, battleNum, npcCount);
                if (gameUser.SweepPool.TurnsNum < turnsNum)
                {
                    if (gameUser.SurplusEnergy > 0)
                    {
                        //每轮扣一次精力
                        gameUser.SurplusEnergy = MathUtils.Subtraction(gameUser.SurplusEnergy, PlotInfo.BattleEnergyNum, (short)0);
                    }
                    else
                    {
                        //每轮扣一次精力
                        gameUser.EnergyNum = MathUtils.Subtraction(gameUser.EnergyNum, PlotInfo.BattleEnergyNum, (short)0);
                    }
                }

                gameUser.SweepPool.UpdateNotify(obj =>
                {
                    gameUser.SweepPool.PlotID = plotID;
                    gameUser.SweepPool.TurnsNum = turnsNum;
                    gameUser.SweepPool.BattleNum = battleNum;
                    return true;
                });
                //gameUser.Update();

            }
            if (saodangQueue.DoRefresh() == 0)
            {
                if (gameUser.UserStatus != UserStatus.Normal)
                {
                    var cacheSet = new GameDataCacheSet<UserQueue>();
                    cacheSet.Delete(saodangQueue);

                    gameUser.UserStatus = UserStatus.Normal;
                    gameUser.ResetSweepPool(0);
                    //gameUser.Update();
                }
            }

            return true;
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:70,代码来源:PlotHelper.cs

示例7: TakeAction

        public override bool TakeAction()
        {
            bool result = true;
            taskInfo = new ConfigCacheSet<StoryTaskInfo>().FindKey(TaskID);
            if (taskInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                //this.ErrorInfo = LanguageManager.GetLang().St3002_NotFind;
                SaveLog(new Exception(string.Format("{0},User:{1},task:{2}", LanguageManager.GetLang().St3002_NotFind, ContextUser.UserID, TaskID)));
                return false;
            }
            _userGeneral = UserGeneral.GetMainGeneral(Uid);
            //获得奖励
            UserTask userTask = new GameDataCacheSet<UserTask>().FindKey(ContextUser.UserID, TaskID);
            if (userTask == null || userTask.TaskState != TaskState.Completed)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St3007_NoCompleted;
                return false;
            }
            //交付物品任务扣除材料
            if (taskInfo.TermsType == PlotTermsType.Shouji || taskInfo.TermsType == PlotTermsType.Delivery)
            {
                UserItemHelper.UseUserItem(Uid, taskInfo.TargetItemID, taskInfo.TargetItemNum);
            }
            userTask.TaskState = TaskState.Close;
            UserTaskLog taskLog = new UserTaskLog()
            {
                LogID = Guid.NewGuid().ToString(),
                TaskID = userTask.TaskID,
                UserID = userTask.UserID,
                TaskType = userTask.TaskType,
                TaskState = userTask.TaskState,
                TaskPrize = string.Format("Experience:{0},GameCoin:{1};GameCoin:{2} ",
                    taskInfo.Experience,
                    taskInfo.GameCoin,
                    ContextUser.GameCoin
                ),
                CreateDate = DateTime.Now
            };
            var sender = DataSyncManager.GetDataSender();
            sender.Send(taskLog);

            ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, taskInfo.GameCoin, int.MaxValue);
            if (taskInfo.TaskType == TaskType.Master && ContextUser.TaskProgress < TaskID)
            {
                ContextUser.TaskProgress = TaskID;
            }
            //ContextUser.Update();

            //任务加佣兵经验
            //var userEmbattles = new GameDataCacheSet<UserEmbattle>().FindAll(UserEmbattle.Index_UserID_MagicID, Uid, ContextUser.UseMagicID);
            //foreach (var userEmbattle in userEmbattles)
            //{
            //    UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, userEmbattle.GeneralID);
            //    if (userGeneral == null) continue;
            //    userGeneral.CurrExperience = MathUtils.Addition(userGeneral.CurrExperience, taskInfo.Experience, int.MaxValue);
            //    //userGeneral.Update();
            //}
            UserHelper.UserGeneralExp(ContextUser.UserID,taskInfo.Experience);

            //开启功能
            TaskHelper.EnableFunction(ContextUser, taskInfo.FunctionEnum);

            //下发可接任务
            TaskHelper.SendAllowTask(ContextUser, TaskID);

            //开启副本
            PlotHelper.EnablePlot(Uid, taskInfo.EnablePlot);

            //保留主线任务
            var cacheSet = new GameDataCacheSet<UserTask>();
            if (userTask.TaskType == TaskType.Master)
            {
                //userTask.Update();
            }
            else
            {
                //原因:最后支线任务无限刷新BUG
                if (!TaskHelper.IsLastTask(userTask))
                {
                    cacheSet.Delete(userTask);
                }
            }
            return result;
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:86,代码来源:Action3007.cs

示例8: FestivalStop

 /// <summary>
 /// 是否本次活动时间
 /// </summary>
 /// <param name="festivalID"></param>
 /// <returns></returns>
 public static void FestivalStop(string userID, int festivalID)
 {
     FestivalInfo festival = new ShareCacheStruct<FestivalInfo>().FindKey(festivalID);
     if (festival != null)
     {
         DateTime startDate = festival.StartDate;
         var cacheSet = new GameDataCacheSet<FestivalRestrain>();
         FestivalRestrain festivalRestrain = cacheSet.FindKey(userID, festivalID);
         if (festivalRestrain != null && festivalRestrain.RefreashDate < startDate)
         {
             cacheSet.Delete(festivalRestrain);
         }
     }
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:19,代码来源:NoviceHelper.cs

示例9: TakeAction

        public override bool TakeAction()
        {
            int subLifeNum = 0;

            var package = UserItemPackage.Get(Uid);
            UserItemInfo userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID));
            if (userItem == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }
            //wuzf modify 2012-05-19
            ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(userItem.ItemID);
            var propsArray = new GameDataCacheSet<UserProps>().FindAll(ContextUser.UserID, u => u.PropType == 1);
            if (propsArray.Count > 0 && propsArray[0].SurplusNum > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1605_BandageUse;
                return false;
            }

            //判断背包是否有血包,没有提示去商城
            var userItems = package.ItemPackage.FindAll(m => !m.IsRemove && new UserItemHelper(m).PropType == 1);
            if (userItems.Count == 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1605_UseTwoGold;
                return false;
            }

            //给佣兵补血
            var userGeneralArray = new GameDataCacheSet<UserGeneral>().FindAll(ContextUser.UserID, u => u.GeneralStatus == GeneralStatus.DuiWuZhong);
            int effectNum = itemInfo.EffectNum;
            foreach (var userGeneral in userGeneralArray)
            {
                int maxLifeNum = UserHelper.GetMaxLife(ContextUser.UserID, userGeneral.GeneralID);
                if (userGeneral.LifeNum < maxLifeNum)
                {
                    subLifeNum = MathUtils.Subtraction(maxLifeNum, userGeneral.LifeNum, 0);
                    userGeneral.LifeNum = MathUtils.Addition(userGeneral.LifeNum, effectNum, maxLifeNum);
                    //userGeneral.Update();
                    effectNum = MathUtils.Subtraction(effectNum, subLifeNum, 0);
                }
            }
            var cacheSet = new GameDataCacheSet<UserProps>();
            UserProps props = new GameDataCacheSet<UserProps>().FindKey(ContextUser.UserID, userItem.ItemID);
            if (props != null)
            {
                props.SurplusNum = effectNum;
                //props.Update();
            }
            else
            {
                props = new UserProps(ContextUser.UserID, itemInfo.ItemID)
                {
                    SurplusNum = effectNum
                };
                cacheSet.Add(props, GameEnvironment.CacheUserPeriod);
            }

            ContextUser.IsUseupItem = false;
            UserItemHelper.UseUserItem(ContextUser.UserID, itemInfo.ItemID, 1);
            foreach (UserProps userPropse in propsArray)
            {
                if (userPropse.SurplusNum == 0)
                {
                    cacheSet.Delete(userPropse);
                }
            }
            return true;
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:71,代码来源:Action1605.cs

示例10: TakeAction

        public override bool TakeAction()
        {
            ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(medicineID);
            if (itemInfo == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }
            if (ops == 1)
            {
                ErrorCode = 1;
                ErrorInfo = string.Format(LanguageManager.GetLang().St11415_ClearMedicine, itemInfo.ItemName, itemInfo.MedicineLv, itemInfo.EffectNum);
                return false;
            }

            UserGeneral general = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, generalID);
            if (general == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St10006_DoesNotExistTheGeneral;
                return false;
            }
            var cacheSet = new GameDataCacheSet<GeneralMedicine>();
            List<GeneralMedicine> generalMedicineArray = cacheSet.FindAll(ContextUser.UserID, g => g.MedicineID.Equals(medicineID) && g.GeneralID == generalID);
            generalMedicineArray.QuickSort((x, y) =>
            {
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;
                return x.BaseNum.CompareTo(y.BaseNum);
            });
            if (generalMedicineArray.Count <= 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
                return false;
            }
            if (UserHelper.IsBeiBaoFull(ContextUser))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1415_GridNumNotEnough;
                return false;
            }

            //UserItem[] userItemArray = UserItem.FindAll(UserItem.Index_UserID, u => (u.ItemStatus == ItemStatus.BeiBao || u.ItemStatus == ItemStatus.CangKu) && u.ItemID == itemID, ContextUser.UserID);
            var package = UserItemPackage.Get(Uid);
            List<UserItemInfo> userItemArray = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemID == itemID);
            //药剂摘除道不足
            int Num = itemInfo.MedicineLv;
            if (userItemArray.Count <= 0 || UserItemMedicineNum(userItemArray) < Num)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1415_MedicineNum;
                return false;
            }
            UserItemHelper.UseUserItem(ContextUser.UserID, itemID, Num);
            if (RandomUtils.GetRandom() <= itemInfo.EffectNum)
            {
                short propertyNum = MedicinePropertyNum(ContextUser.UserID, medicineID, generalID);
                switch (itemInfo.MedicineType)
                {
                    case 1:
                        general.PowerNum = MathUtils.Subtraction(general.PowerNum, propertyNum);
                        break;
                    case 2:
                        general.SoulNum = MathUtils.Subtraction(general.SoulNum, propertyNum);
                        break;
                    case 3:
                        general.IntellectNum = MathUtils.Subtraction(general.IntellectNum, propertyNum);
                        break;
                    default:
                        general.PowerNum = general.PowerNum; ;
                        break;
                }
                //general.Update();
                cacheSet.Delete(generalMedicineArray[0]);
                ErrorCode = 2;
                UserItemHelper.AddUserItem(ContextUser.UserID, medicineID, 1);
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St11415_Clearfail;
                return false;
            }

            return true;
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:88,代码来源:Action1415.cs

示例11: TakeAction

        public override bool TakeAction()
        {
            var cacheSet = new GameDataCacheSet<UserQueue>();
            List<UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);

            foreach (UserQueue queue in userQueueList)
            {
                if (queue != null)
                {
                    int npcCount = new ConfigCacheSet<PlotNPCInfo>().FindAll(m => m.PlotID == plotID).Count;
                    //战斗次数
                    int totalBattleNum = (int)Math.Floor((double)(queue.TotalColdTime - queue.DoRefresh()) / PlotInfo.BattleSpeedNum);
                    int turnsNum = totalBattleNum / npcCount;
                    int battleNum = totalBattleNum % npcCount;
                    //没发生战斗或上未通关都返还精力
                    //if (turnsNum == 0 || battleNum > 0)
                    //{
                    //    ContextUser.EnergyNum = ContextUser.EnergyNum.Addition(PlotInfo.BattleEnergyNum, short.MaxValue);
                    //}
                    cacheSet.Delete(queue);
                }
            }

            if (ContextUser.UserStatus == UserStatus.SaoDang)
            {
                ContextUser.ResetSweepPool(0);
                ContextUser.UserStatus = UserStatus.Normal;
                //ContextUser.Update();
            }
            return true;
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:31,代码来源:Action4010.cs

示例12: TakeAction

        public override bool TakeAction()
        {
            UserQueue userQueue = null;
            int energyNum;
            int coleTime = GetSweepColdTime(out energyNum);
            short surEnergy = MathUtils.Addition(ContextUser.EnergyNum, ContextUser.SurplusEnergy, short.MaxValue);

            if ((ContextUser.EnergyNum == 0 && ContextUser.SurplusEnergy == 0) || surEnergy < energyNum)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_EnergyNotEnough;
                return false;
            }
            int goldNum = GetGoldNum(out userQueue);
            if (goldNum == 0)
            {
                return false;
            }
            if (ops == 1)
            {
                //提示晶石操作
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St4008_Tip, goldNum);
            }
            else if (ops == 2)
            {
                //使用晶石确认操作
                int userGoldNum = ContextUser.GoldNum;
                if (userGoldNum < goldNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return false;
                }
                //晶石扫荡
                if (userQueue != null)
                {
                    DoAccelerateQueue(goldNum, userQueue.DoRefresh(), userQueue.GetTiming(), userQueue.TotalColdTime);
                    //加速完清除队列
                    var queueCacheSet = new GameDataCacheSet<UserQueue>();
                    queueCacheSet.Delete(userQueue);
                    ContextUser.ResetSweepPool(0);
                    //ContextUser.Update();
                }
                else
                {
                    //清除扫荡池
                    var sweepCacheSet = new GameDataCacheSet<UserSweepPool>();
                    List<UserSweepPool> sweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID);
                    foreach (UserSweepPool sweepPool in sweepPoolList)
                    {
                        if (sweepPool != null)
                        {
                            sweepCacheSet.Delete(sweepPool);
                        }
                    }
                    var itemList = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao);
                    if (itemList.Count >= ContextUser.GridNum)
                    {
                        this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                        this.ErrorInfo = LanguageManager.GetLang().St4007_BeiBaoTimeOut;
                        return false;
                    }
                    DoAccelerateQueue(goldNum, coleTime, 0, coleTime);
                }
                DateTime startDate = userQueue != null ? userQueue.Timing : DateTime.Now;
                UserLogHelper.AppenRaidsLog(ContextUser.UserID, 2, startDate, DateTime.Now, (short)GetSweepEnergy(out energyNum), goldNum);
            }
            else
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }
            return true;
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:75,代码来源:Action4008.cs

示例13: TakeAction

        public override bool TakeAction()
        {
            var cacheSet = new GameDataCacheSet<UserQueue>();
            List<UserQueue> userQueueArray = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.JingJiTiaoZhan);
            if (userQueueArray.Count > 0)
            {
                UserQueue userQueue = userQueueArray[0];
                int queueColdTime = userQueue.DoRefresh();
                queueColdTime = queueColdTime < 0 ? 0 : queueColdTime;
                if (ops == 1)
                {
                    this.ErrorCode = ops;
                    this.ErrorInfo = GetPrice().ToString();
                    return false;
                }
                else if (ops == 2)
                {
                    if (ContextUser.GoldNum >= GetPrice())
                    {
                        this.ErrorCode = ops;
                        ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GetPrice(), int.MaxValue);
                        //ContextUser.Update();
                        cacheSet.Delete(userQueue);
                    }
                    else
                    {

                        this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                        this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                        return false;
                    }
                }
                else
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    return false;
                }
            }
            return true;
        }
开发者ID:jinfei426,项目名称:Scut,代码行数:40,代码来源:Action5105.cs

示例14: TakeAction

        public override bool TakeAction()
        {
            List<UserQueue> queueList = new GameDataCacheSet<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);
            if (queueList.Count > 0)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St4007_Saodanging;
                return false;
            }
            var itemList = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao);
            if (itemList.Count >= ContextUser.GridNum)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St4007_BeiBaoTimeOut;
                return false;
            }
            List<PlotNPCInfo> npcList = new ConfigCacheSet<PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
            //战斗次数
            int plotNpcNum = npcList.Count;
            int energyNum = 0;
            int battleNum;

            if (ops == 1)
            {
                //用尽精力,玩家可扫荡轮数
                energyNum = ContextUser.EnergyNum > 200 ? 200 : ContextUser.EnergyNum.ToInt();
                int userTurnsNum = (int)Math.Floor((double)energyNum / PlotInfo.BattleEnergyNum);
                battleNum = userTurnsNum * plotNpcNum;
                coldTime = battleNum * PlotInfo.BattleSpeedNum;
            }
            else if (ops == 2)
            {
                //30分钟
                coldTime = Time_30;
                battleNum = PlotHelper.GetBattleNum(Time_30);
                energyNum = PlotHelper.GetTurnsNum(plotNpcNum, battleNum) * PlotInfo.BattleEnergyNum;
            }
            else if (ops == 3)
            {
                //60分钟
                coldTime = Time_60;
                battleNum = PlotHelper.GetBattleNum(Time_60);
                energyNum = PlotHelper.GetTurnsNum(plotNpcNum, battleNum) * PlotInfo.BattleEnergyNum;
            }
            else
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }
            if (ContextUser.EnergyNum == 0 || ContextUser.EnergyNum < energyNum)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St_EnergyNotEnough;
                return false;
            }
            //清除扫荡池
            var sweepCacheSet = new GameDataCacheSet<UserSweepPool>();
            List<UserSweepPool> sweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID);
            foreach (UserSweepPool sweepPool in sweepPoolList)
            {
                if (sweepPool != null)
                {
                    sweepCacheSet.Delete(sweepPool);
                }
            }

            if (coldTime > 0)
            {
                //在开始战斗时扣一次玩家精力,无战斗离开返还
                ContextUser.ResetSweepPool(plotID);
                //开始扫荡暂不扣精力
                //ContextUser.RemoveEnergyNum(PlotInfo.BattleEnergyNum);
                ContextUser.UserStatus = UserStatus.SaoDang;
                //ContextUser.Update();

                //放入队列中
                UserQueue userQueue = new UserQueue()
                {
                    QueueID = Guid.NewGuid().ToString(),
                    UserID = ContextUser.UserID,
                    QueueType = QueueType.SaoDang,
                    QueueName = QueueType.SaoDang.ToString(),
                    TotalColdTime = coldTime,
                    Timing = DateTime.Now,
                    ColdTime = coldTime,
                    IsSuspend = false
                };
                new GameDataCacheSet<UserQueue>().Add(userQueue);

            }
            return true;
        }
开发者ID:huyanoperation,项目名称:Scut,代码行数:92,代码来源:Action4007.cs

示例15: TakeAction

        public override bool TakeAction()
        {
            //刷新副本奖励
            if (!PlotHelper.RefleshPrize(ContextUser.UserID, plotID))
            {
                //this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                //this.ErrorInfo = LanguageManager.GetLang().St4007_SaodangOver;
            }
            var sweepCacheSet = new GameDataCacheSet<UserSweepPool>();
            var tempSweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID, m => m.IsSend == false);
            tempSweepPoolList.QuickSort((x, y) =>
            {
                if (x == null && y == null) return 0;
                if (x != null && y == null) return 1;
                if (x == null) return -1;
                int result = 0;
                x.UserID = x.UserID == null ? "" : x.UserID;
                y.UserID = y.UserID == null ? "" : y.UserID;

                result = x.UserID.CompareTo(y.UserID);
                if (result == 0)
                {
                    if (x.TurnsNum < y.TurnsNum)
                    {
                        return -1;
                    }
                    else if (x.TurnsNum > y.TurnsNum)
                    {
                        return 1;
                    }
                    else
                    {
                        if (x.BattleNum < y.BattleNum)
                        {
                            return -1;
                        }
                        else if (x.BattleNum > y.BattleNum)
                        {
                            return 1;
                        }
                    }
                }
                return result;
            });

            userEmbattleList = new GameDataCacheSet<UserEmbattle>().FindAll(ContextUser.UserID, m => m.GeneralID > 0 && m.MagicID == ContextUser.UseMagicID);

            foreach (UserSweepPool userSweepPool in tempSweepPoolList)
            {
                if (userSweepPool != null)
                {
                    sweepCacheSet.Delete(userSweepPool);
                }
            }

            var tempList = new List<UserSweepPool>(tempSweepPoolList);
            int pageSize = 12;
            int index = 0;
            if (tempList.Count > pageSize)
            {
                index = tempList.Count - pageSize;
            }
            else
            {
                pageSize = tempList.Count;
            }
            if (tempList.Count > 0)
            {
                userSweepPoolList = tempList.GetRange(index, pageSize);
            }

            return true;
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:73,代码来源:Action4009.cs


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