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


C# ShareCacheStruct.FindKey方法代码示例

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


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

示例1: AddBack

        /// <summary>
        /// 初始化背包
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static void AddBack(GameUser user)
        {
            var cacheSet = new PersonalCacheStruct<UserPack>();
            var cacheSetBackPack = new ShareCacheStruct<BackpackConfigInfo>();
            var userPack = cacheSet.FindKey(user.UserID);

            if (userPack == null)
            {
                userPack = new UserPack();

                userPack.UserID = user.UserID.ToInt();
                userPack.CreateDate = DateTime.Now;
                var backpackConfig = cacheSetBackPack.FindKey(BackpackType.ZhuangBei);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.ZhuangBei;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                }

                backpackConfig = cacheSetBackPack.FindKey(BackpackType.YongBing);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.YongBing;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                }

                backpackConfig = cacheSetBackPack.FindKey(BackpackType.HunJi);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.HunJi;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                }

                backpackConfig = cacheSetBackPack.FindKey(BackpackType.BeiBao);
                if (backpackConfig != null)
                {
                    var packType = new PackType();
                    packType.BackpackType = BackpackType.BeiBao;
                    packType.OpenNum = 0;
                    packType.Position = backpackConfig.DefaultNum;
                    user.GridNum = MathUtils.Addition(user.GridNum, backpackConfig.DefaultNum);
                }
            }

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

示例2: Add

        public bool Add(int type,int index,string code)
        {
            var cache = new ShareCacheStruct<ExchangeCode>();
            int key = UniqueKey(type, index);
            //if (null != cache.FindKey(key)) return false; // this type has been added
            ExchangeCode ec = cache.FindKey(key);
            if (null != ec)
            {
                return true;
            }
            else
            {
                ec = new ExchangeCode();
                ec.key = key;
                ec.Type = (byte)type;
                ec.Index = index;
                ec.Code = code;
                if (ec.Type == (byte)GameConfigExchangeCode.ExchangeCodeType.ASType_NSNSDuiHuan_AnHuiTai_1 ||
                    ec.Type == (byte)GameConfigExchangeCode.ExchangeCodeType.ASType_NSNSDuiHuan_JiaRi_1)
                {
                    ec.cnt = int.MaxValue;

                }
                cache.Add(ec);
            }
            return true;
        }
开发者ID:guccang,项目名称:scutlogic,代码行数:27,代码来源:ExchangeCodeMgr.cs

示例3: TakeAction

 public override bool TakeAction()
 {
     if (string.IsNullOrEmpty(ContextUser.MercenariesID))
     {
         ErrorCode = LanguageManager.GetLang().ErrorCode;
         return false;
     }
     var cacheSet = new ShareCacheStruct<ServerFight>();
     FightCombat combat = new FightCombat();
     ServerFight fight = cacheSet.FindKey(combat.FastID, ContextUser.MercenariesID);
     if (fight != null)
     {
         if (!string.IsNullOrEmpty(fight.CombatMember))
         {
             fight.CombatMember = fight.CombatMember.Replace(ContextUser.UserID, "").Replace(",,", ",");
             if (fight.CombatMember == ",")
             {
                 fight.CombatMember = string.Empty;
             }
         }
         FightUser fightUser = GuildFightCombat._fightUserList.Find(m => m.UserId == ContextUser.UserID);
         if (fightUser != null)
         {
             GuildFightCombat._fightUserList.Remove(fightUser);
         }
         ContextUser.UserStatus = UserStatus.Normal;
     }
     else
     {
         ErrorCode = LanguageManager.GetLang().ErrorCode;
         ErrorInfo = LanguageManager.GetLang().St6411_FailedToExit;
         return false;
     }
     return true;
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:35,代码来源:Action6411.cs

示例4: TakeAction

        public override bool TakeAction()
        {

            if (new GameDataCacheSet<UserFunction>().FindKey(Uid, FunctionEnum.PetRun) == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_NoFun;
                return false;
            }
            UserDailyRestrain restrain = new GameDataCacheSet<UserDailyRestrain>().FindKey(Uid);
            if (restrain != null && restrain.UserExtend != null)
            {
                var dailyCacheSet = new ShareCacheStruct<DailyRestrainSet>();
                if (dailyCacheSet.FindKey(RestrainType.PetRun) != null)
                    _runTimes = MathUtils.Subtraction(dailyCacheSet.FindKey(RestrainType.PetRun).MaxNum, restrain.UserExtend.PetRunTimes, 0);
                if (dailyCacheSet.FindKey(RestrainType.PetIntercept) != null)
                    _interceptTimes = MathUtils.Subtraction(dailyCacheSet.FindKey(RestrainType.PetIntercept).MaxNum, restrain.UserExtend.PetIntercept, 0);
                if (dailyCacheSet.FindKey(RestrainType.PetHelp) != null)
                    _helpTimes = MathUtils.Subtraction(dailyCacheSet.FindKey(RestrainType.PetHelp).MaxNum, restrain.UserExtend.PetHelp, 0);
            }
            var petRun = new ShareCacheStruct<PetRunPool>().FindKey(Uid);
            if (petRun != null)
            {
                //问题:在赛跑时有重刷点亮宠物后,等赛跑完服务端与客户端记录宠物ID不一致,原因是赛跑完有将宠物ID清除
                if (petRun.PetID > 0 && petRun.ColdTime == 0)
                {
                    UserHelper.ProcessPetPrize(petRun);
                }
                _coldTime = petRun.ColdTime;
                _petHead = (new ConfigCacheSet<PetInfo>().FindKey(petRun.PetID) ?? new PetInfo()).PetHead;
                if (ContextUser.UserExtend != null)
                    _petId = ContextUser.UserExtend.LightPetID;
            }
            return true;
        }
开发者ID:jinfei426,项目名称:Scut,代码行数:35,代码来源:Action3201.cs

示例5: CreateSkillLvInfo

 public static List<SkillLvInfo> CreateSkillLvInfo(CombatGeneral general)
 {
     List<SkillLvInfo> _skillLvList = new List<SkillLvInfo>();
     if (general.GeneralID == LanguageManager.GetLang().GameUserGeneralID)
     {
         var abilityCacheSet = new ShareCacheStruct<AbilityInfo>();
         var skillLvSet = new ShareCacheStruct<SkillLvInfo>();
         UserTrump userTrump = new PersonalCacheStruct<UserTrump>().FindKey(general.UserID, TrumpInfo.CurrTrumpID) ?? new UserTrump();
         if (userTrump.LiftNum > 0)
         {
             userTrump.SkillInfo.Foreach(obj =>
             {
                 var abilityInfo = abilityCacheSet.FindKey(obj.AbilityID) ?? new AbilityInfo();
                 if (abilityInfo.AttackType == AttackType.Trigger)
                 {
                     var temp = skillLvSet.FindKey(obj.AbilityID, obj.AbilityLv);
                     if (temp != null)
                     {
                         _skillLvList.Add(temp);
                     }
                 }
                 return true;
             });
         }
     }
     return _skillLvList;
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:27,代码来源:TrumpAbilityAttack.cs

示例6: TakeAction

 public override bool TakeAction()
 {
     var cacheSet = new ShareCacheStruct<UserFriends>();
     UserFriends userFriend = cacheSet.FindKey(ContextUser.UserID, friendID);
     UserFriends userFriend1 = cacheSet.FindKey(friendID, ContextUser.UserID);
     //如果原来是好友 要将对方的状态改为关注 其他的直接删除
     if (userFriend.FriendType == FriendType.Friend)
     {
         cacheSet.Delete(userFriend);
         userFriend1.FriendType = FriendType.Attention;
     }else
     {
         cacheSet.Delete(userFriend);
     }
    
     return true;
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:17,代码来源:Action9104.cs

示例7: TakeAction

        public override bool TakeAction()
        {
            var cache = new ShareCacheStruct<testUpdate>();
            var tu = new testUpdate();
            tu.index = (int)cache.GetNextNo();
            tu.itemID = 0;

            tu.ModifyLocked(() => {
                tu.itemID = 1;
            });

            tu = cache.FindKey(tu.index);

            tu = new testUpdate();
            tu.index = (int)cache.GetNextNo();
            tu.itemID = 100;
            cache.Add(tu);
            tu = cache.FindKey(tu.index);
            //   try
            //   {
            //       var UA = new UserAnalysis();
            //       foreach (logData d in requestPack.items)
            //       {
            //           UA.DeviceId = d.DeviceID;
            //           UA.Channel = d.Channel;
            //           UA.SimType = d.SimType;
            //           UA.ActionType = (UserAnalysis.E_ActionType)d.ActionType;
            //           UA.ProductionId = d.ProductionId;
            //           UA.ActionTime = System.DateTime.Now;
            //           //DataSyncQueueManager.SendToDb(UA);
            //           Console.WriteLine("{0}GameSession:{1}", DateTime.Now.ToString("HH:mm:ss"), GameSession.Count);
            //       }
            //       responsePack = new ResponsePack();
            //       responsePack.ActionId = 80000;
            //       responsePack.ErrorCode = 101;
            //       responsePack.ErrorInfo = "Success";
            //       return true;
            //   }
            //   catch (Exception ex)
            //   {
            //       TraceLog.WriteError("TakeAction:{0} error:{1}", actionId, ex);
            //       return false;
            //   }
            return true;
        }
开发者ID:guccang,项目名称:scutlogic,代码行数:45,代码来源:Action80000.cs

示例8: TakeAction

        public override bool TakeAction()
        {
            int totalDate = (ConfigEnvSet.GetInt("UserQueue.GuildMemberDel") * 60 * 60);
            var memberSet = new ShareCacheStruct<GuildMember>();
            List<GuildMember> memberArray = memberSet.FindAll(m => m.GuildID == guildID);
            GuildMember userMember = memberSet.FindKey(guildID, ContextUser.UserID);
            if (userMember != null && userMember.PostType == PostType.Chairman && memberArray.Count > 1)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6010_Chairman;
                return false;
            }
            if (userMember != null)
            {
                if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
                {
                    memberSet.Delete(userMember);
                    ContextUser.MercenariesID = string.Empty;
                    //ContextUser.Update();
                    CombatHelper.RemoveGuildAbility(ContextUser);
                }
                var guildSet = new ShareCacheStruct<UserGuild>();
                UserGuild guildInfo = guildSet.FindKey(guildID);
                if (guildInfo != null && userMember.PostType == PostType.Chairman && memberArray.Count <= 1)
                {
                    guildSet.Delete(guildInfo);
                }

                List<UserQueue> queueArray = new PersonalCacheStruct<UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.TuiChuGongHui);
                if (queueArray.Count > 0)
                {
                    UserQueue queue = queueArray[0];
                    queue.Timing = DateTime.Now;
                    queue.TotalColdTime = totalDate;
                    queue.ColdTime = totalDate;
                    //queue.Update();
                }
                else
                {
                    UserQueue userQueue = new UserQueue()
                    {
                        QueueID =
                            Guid.NewGuid().ToString(),
                        QueueName = QueueType.TuiChuGongHui.ToString(),
                        QueueType = QueueType.TuiChuGongHui,
                        TotalColdTime = totalDate,
                        ColdTime = totalDate,
                        Timing = DateTime.Now,
                        IsSuspend = false,
                        UserID = ContextUser.UserID
                    };
                    new PersonalCacheStruct<UserQueue>().Add(userQueue);
                }
            }
            return true;
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:56,代码来源:Action6010.cs

示例9: TakeAction

        public override bool TakeAction()
        {
            var cacheSet = new ShareCacheStruct<UserApply>();
            UserApply apply = cacheSet.FindKey(guildID, ContextUser.UserID);
            if (apply != null)
            {
                cacheSet.Delete(apply);
            }

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

示例10: TakeAction

        public override bool TakeAction()
        {
            if (string.IsNullOrEmpty(ContextUser.MercenariesID))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }
            FightCombat fightCombat = new FightCombat();
            var cacheSet = new ShareCacheStruct<ServerFight>();
            ServerFight fight = cacheSet.FindKey(fightCombat.FastID, ContextUser.MercenariesID);
            if (fight != null)
            {
                if (GuildFightCombat.IsFightDate())
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St6412_FightWarDate;
                    return false;
                }

                var fightUser = GuildFightCombat._fightUserList.Find(m => !m.IsRemove && m.UserId == ContextUser.UserID);
                if (fightUser == null)
                {
                    fightUser = new FightUser();
                    fightUser.GuildID = fight.GuildID;
                    fightUser.UserId = ContextUser.UserID;
                    fightUser.UserName = ContextUser.NickName;
                    fightUser.WinCount = 0;
                    fightUser.CityID = fight.CityID;
                    fightUser.ObtainNum = 0;
                    fightUser.InspirePercent = 0;
                    fightUser.IsRemove = false;
                    fightUser.IsNotEnough = false;
                    GuildFightCombat._fightUserList.Add(fightUser);
                }
                if (!string.IsNullOrEmpty(fight.CombatMember) && !GuildFightCombat.IsFightWar(ContextUser.UserID, fight.CombatMember))
                {
                    fight.CombatMember = fight.CombatMember + ContextUser.UserID + ",";
                }
                else
                {
                    fight.CombatMember = ContextUser.UserID + ",";
                }
                ContextUser.UserStatus = UserStatus.FightCombat;
                ErrorCode = 0;
                ErrorInfo = LanguageManager.GetLang().St6412_FightWarSuccess;
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St6412_HaveSignedUp;
                return false;
            }
            return true;
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:54,代码来源:Action6412.cs

示例11: TakeAction

        public override bool TakeAction()
        {
            GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(memberID);
            var guildCacheSet = new ShareCacheStruct<GuildMember>();
            GuildMember member = guildCacheSet.FindKey(guildID, memberID);
            if (member != null)
            {
                if (string.IsNullOrEmpty(gameUser.MercenariesID))
                {
                    return false;
                }
                guildCacheSet.Delete(member);
                //gameUser.UserLocation = Location.City;
                gameUser.MercenariesID = string.Empty;
                //gameUser.Update();
                CombatHelper.RemoveGuildAbility(gameUser);
            }
            int totalDate = (ConfigEnvSet.GetInt("UserQueue.GuildMemberDel") * 60 * 60);
            List<UserQueue> queueArray = new GameDataCacheSet<UserQueue>().FindAll(memberID, m => m.QueueType == QueueType.TuiChuGongHui);
            if (queueArray.Count > 0)
            {
                //new UserQueue().ReLoadUser(memberID);
                queueArray = new GameDataCacheSet<UserQueue>().FindAll(memberID, m => m.QueueType == QueueType.TuiChuGongHui);
            }
            if (queueArray.Count > 0)
            {
                UserQueue queue = queueArray[0];
                queue.Timing = DateTime.Now;
                queue.TotalColdTime = totalDate;
                queue.ColdTime = totalDate;
                //queue.Update();
            }
            else
            {
                UserQueue userQueue = new UserQueue()
                {
                    QueueID = Guid.NewGuid().ToString(),
                    QueueName = QueueType.TuiChuGongHui.ToString(),
                    QueueType = QueueType.TuiChuGongHui,
                    TotalColdTime = totalDate,
                    ColdTime = totalDate,
                    Timing = DateTime.Now,
                    IsSuspend = false,
                    UserID = ContextUser.UserID
                };
                new GameDataCacheSet<UserQueue>().Add(userQueue);

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

示例12: Init

        void Init()
        {
            var cache = new ShareCacheStruct<ShareRealItemCnt>();
            List<int> itemIds = GameConfigMgr.Instance().getHappyDataKeys();
            memoryRealInfoDataModel.HappyData hd = null;
            for(int i=0;i<itemIds.Count; ++i)
            {
               if( null ==  cache.FindKey(itemIds[i])) // first add
               {
                   ShareRealItemCnt sric = new ShareRealItemCnt();
                   hd = GameConfigMgr.Instance().getHappyData(itemIds[i]);
                   sric.itemID  = hd.itemID;
                   sric.num     = hd.RefleshNum;
                   cache.Add(sric);
               }
            }

            string timestr = GameConfigMgr.Instance().getString("timer_item_cnt", "600000,600000");
            string[] tt = timestr.Split(',');
            int b0 = int.Parse(tt[0]);
            int b1 = int.Parse(tt[1]);
            TimerMgr.Singleton().add(typeof(RealItemCntUpdate).ToString(), actionrealItemCnt,b0,b1);

            bool openDebug = GameConfigMgr.Instance().getInt("timer_open_debug",0)==1;
            if(openDebug)
            {
                timestr = GameConfigMgr.Instance().getString("time_hdm_cnt", "600000,600000");
                tt = timestr.Split(',');
                 b0 = int.Parse(tt[0]);
                 b1 = int.Parse(tt[1]);
                TimerMgr.Singleton().add("HappyModeData_EnterNum", action_HappyModeData_enterNum, b0, b1);
            }
            else
            {
                //每天05点执行
                try
                {
                    timestr = GameConfigMgr.Instance().getString("time_hdm_cnt_timming", "05:15");
                }
                catch
                {
                    timestr = "05:15";
                }
                TimeListener.Append(PlanConfig.EveryDayPlan(DoEveryDayExecute, "EveryDayTask", timestr));
                ConsoleLog.showNotifyInfo("HappyModeData_EnterNum begin:" + timestr);
            }
        }
开发者ID:guccang,项目名称:scutlogic,代码行数:47,代码来源:RealItemCntUpdate.cs

示例13: GenerateId

 /// <summary>
 /// 生成Id
 /// </summary>
 /// <returns></returns>
 public static int GenerateId()
 {
     lock (SyncRoot)
     {
         string userCode = "USER_CODE";
         var userCache = new ShareCacheStruct<UserSet>();
         UserSet userSet = userCache.FindKey(userCode);
         if (userSet == null)
         {
             userSet = new UserSet() { Code = userCode, CurrUserId = 1000 };
             userCache.Add(userSet);
         }
         userSet.CurrUserId++;
         userCache.Update();
         return userSet.CurrUserId;
     }
 }
开发者ID:rayphoenix333,项目名称:Scut,代码行数:21,代码来源:UserSet.cs

示例14: isOk

        public int isOk(int type,int index,string code)
        {
            var cache = new ShareCacheStruct<ExchangeCode>();
            int key = UniqueKey(type, index);
            ExchangeCode ec = cache.FindKey(key);
            if (null == ec)        return 1;    // not find
            if (type  != ec.Type)  return 2;
            if (index != ec.Index) return 3;
            if (code  != ec.Code)  return 4;
            if (ec.cnt <= 0)       return 5;    // used...

            ec.ModifyLocked(() =>
            {
                ec.cnt -= 1;
            });
            return 0;
        }
开发者ID:guccang,项目名称:scutlogic,代码行数:17,代码来源:ExchangeCodeMgr.cs

示例15: ShowLairReward

        public static ItemBaseInfo ShowLairReward(LairTreasure lairTreasure, GameUser gameUser, LairTreasureType lairTreasureType)    //��ʾ��õ���Ʒ
        {
            var cacheSetItem = new ShareCacheStruct<ItemBaseInfo>();
            ItemBaseInfo itemBaseInfo = null;
            var lairRewardList = new ShareCacheStruct<LairRewardInfo>().FindAll(s => s.LairPosition == lairTreasure.LairPosition && s.LairTreasureType == lairTreasureType.ToInt());
            if (lairRewardList.Count >0)
            {
                var lairRewardInfo = lairRewardList[RandomUtils.GetRandom(0, lairRewardList.Count)];
                itemBaseInfo = cacheSetItem.FindKey(lairRewardInfo.ItemID);
                if (itemBaseInfo != null)
                {
                    UserItemHelper.AddUserItem(gameUser.UserID, lairRewardInfo.ItemID, lairTreasure.Num);
                }
            }

            return itemBaseInfo;
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:17,代码来源:LairTreasuerHelp.cs


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