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


C# ShareCacheStruct类代码示例

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


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

示例1: TakeAction

        public override bool TakeAction()
        {
            ItemBaseInfo itemBaseInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(_materialsID);
            if (itemBaseInfo.ItemType == ItemType.CaiLiao)
            {
                //寻材料
                List<MonsterInfo> monsterArray = new ShareCacheStruct<MonsterInfo>().FindAll(m => m.ItemID == _materialsID);
                if (monsterArray.Count > 0)
                {
                    MonsterInfo monsterInfo = monsterArray[0];
                    var plotEmbattles = new ShareCacheStruct<PlotEmbattleInfo>().FindAll(m => m.MonsterID == monsterInfo.MonsterID);
                    foreach (var embattle in plotEmbattles)
                    {
                        PlotNPCInfo npcInfo = new ShareCacheStruct<PlotNPCInfo>().FindKey(embattle.PlotNpcID);
                        if (npcInfo != null)
                        {
                            PlotInfo temp = new ShareCacheStruct<PlotInfo>().FindKey(npcInfo.PlotID);
                            if (temp != null && temp.CityID > CurrCityID(ContextUser.UserLv))
                            {
                                ErrorCode = LanguageManager.GetLang().ErrorCode;
                                ErrorInfo = LanguageManager.GetLang().St1604_MaterialsCityID;
                                return false;
                            }
                            if (CheckPlot(temp))
                            {
                                _plotInfo = temp;
                                break;
                            }
                        }
                    }
                }
            }

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

示例2: AddPrize

 public static void AddPrize(string UserID, int itemID, string mailContent)
 {
     string ItemPackage = itemID + "=1=1";
     var cacheset = new ShareCacheStruct<UserTakePrize>();
     UserTakePrize takeprize = new UserTakePrize()
     {
         CreateDate = DateTime.Now,
         CrystalPackage = string.Empty,
         EnergyNum = 0,
         ExpNum = 0,
         GainBlessing = 0,
         GameCoin = 0,
         Gold = 0,
         ID = Guid.NewGuid().ToString(),
         ItemPackage = ItemPackage,
         IsTasked = false,
         MailContent = mailContent,
         ObtainNum = 0,
         OpUserID = 0,
         SparePackage = string.Empty,
         UserID = UserID.ToInt(),
         VipLv = 0,
     };
     cacheset.Add(takeprize, GameEnvironment.CacheGlobalPeriod);
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:25,代码来源:GuildFightCombat.cs

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

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

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

示例6: GameTable

 private GameTable()
 {
     _cardRole = new CardRole();
     _pokerConfig = new ShareCacheStruct<PokerInfo>();
     _userCacheSet = new GameDataCacheSet<GameUser>();
     _roomStruct = new MemoryCacheStruct<RoomData>();
 }
开发者ID:kehaoran74,项目名称:Scut,代码行数:7,代码来源:GameTable.cs

示例7: BuildPacket

        public override void BuildPacket()
        {

            PushIntoStack(generalInfo == null ? string.Empty : generalInfo.GeneralName.ToNotNullString());
            PushIntoStack(generalMedicineArray.Count);
            foreach (GeneralMedicine item in generalMedicineArray)
            {
                ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(item.MedicineID);

                int itemcount = TrumpHelper.GetUserItemNum(item.UserID, item.MedicineID);
                if (itemcount > 0)
                {
                    gridStatus = 1;
                }
                else
                {
                    gridStatus = 2;
                }

                DataStruct ds = new DataStruct();
                ds.PushIntoStack(item.MedicineID);
                ds.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                ds.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : itemInfo.MedicineLv);
                ds.PushIntoStack(itemInfo == null ? LanguageManager.GetLang().shortInt : itemInfo.MedicineType);
                ds.PushIntoStack((short)GetGeneralMedicine(item));
                ds.PushIntoStack(gridStatus);
                ds.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                PushIntoStack(ds);
            }
            this.PushIntoStack(powerNum);
            this.PushIntoStack(soulNum);
            this.PushIntoStack(intellectNum);
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:33,代码来源:Action1406.cs

示例8: OnCreateAfter

 /// <summary>
 /// 创始成功之后处理事件
 /// </summary>
 public void OnCreateAfter(GameUser user)
 {
     var cacheSet = new ShareCacheStruct<UserNickName>();
     UserNickName u = new UserNickName(user.UserId);
     u.NickName = user.NickName;
     cacheSet.Add(u);
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:10,代码来源:RoleFunc.cs

示例9: ProcessCmd

        protected override void ProcessCmd(string[] args)
        {
            int magicID = args.Length > 0 ? args[0].Trim().ToInt() : 0;
            short magicLv = args.Length > 1 ? args[1].Trim().ToShort() : (short)1;

            var cacheSet = new PersonalCacheStruct<UserMagic>();
            var userMagic = cacheSet.FindKey(UserID, magicID);
            MagicInfo magic = new ShareCacheStruct<MagicInfo>().FindKey(magicID);
            if (magic == null)
            {
                return;
            }
            if (userMagic == null)
            {
                userMagic = new UserMagic()
                {
                    UserID = UserID,
                    MagicID = magicID,
                    MagicLv = magicLv,
                    IsEnabled = false,
                    MagicType = magic.MagicType,
                };
                cacheSet.Add(userMagic);
            }
            else
            {
                userMagic.MagicLv = magicLv;
            }
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:29,代码来源:MagicCommand.cs

示例10: GetVipUseNum

 /// <summary>
 /// 每日限制次数
 /// </summary>
 /// <returns></returns>
 public static int GetVipUseNum(int vipLv, RestrainType restrainType)
 {
     int rType = (int)restrainType;
     int baseNum = 0;
     int MaxNum = 0;
     int vipNum = 0;
     DailyRestrainSet restrainSet = new ShareCacheStruct<DailyRestrainSet>().FindKey(restrainType);
     if (restrainSet != null)
     {
         baseNum = restrainSet.MaxNum;
     }
     VipLvInfo lvInfo = new ConfigCacheSet<VipLvInfo>().FindKey(vipLv);
     var restrainArray = new CacheList<DailyRestrain>();
     if (lvInfo != null)
     {
         restrainArray = lvInfo.DailyRestrain;
     }
     foreach (DailyRestrain daily in restrainArray)
     {
         if (daily.ID == rType)
         {
             vipNum = daily.Num;
         }
     }
     MaxNum = MathUtils.Addition(baseNum, vipNum, int.MaxValue);
     return MaxNum;
 }
开发者ID:jinfei426,项目名称:Scut,代码行数:31,代码来源:VipHelper.cs

示例11: TakeAction

        public override bool TakeAction()
        {
            var plotTeam = new PlotTeamCombat(ContextUser);
            MorePlotTeam moreTeam = plotTeam.GetTeam(teamID);

            if (moreTeam != null && moreTeam.UserList.Count <= 1)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St4210_PeopleNotEnough;
                return false;
            }

            PlotInfo plotInfo = new ShareCacheStruct<PlotInfo>().FindKey(plotID);
            if (plotInfo == null)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St4210_PlotNotEnough;
                return false;
            }

            if(!plotTeam.DoStart(teamID))
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                return false;
            }

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

示例12: BuildPacket

        public override void BuildPacket()
        {
            this.PushIntoStack(magicList.Count);
            foreach (MagicInfo magicInfo in magicList)
            {
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(magicInfo.MagicID);
                dsItem.PushIntoStack(magicInfo.MagicType.ToInt());
                dsItem.PushIntoStack(magicInfo.MagicName.ToNotNullString());
                dsItem.PushIntoStack(magicInfo.HeadID.ToNotNullString());
                dsItem.PushIntoStack(magicInfo.MagicDesc.ToNotNullString());

                var magicLvList = new ShareCacheStruct<MagicLvInfo>().FindAll(m => m.MagicID == magicInfo.MagicID);
                dsItem.PushIntoStack(magicLvList.Count);
                foreach (MagicLvInfo magicLv in magicLvList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(magicLv.MagicLv.ToShort());
                    dsItem1.PushIntoStack(magicLv.ExpNum);
                    dsItem1.PushIntoStack(magicLv.ColdTime);
                    dsItem1.PushIntoStack(magicLv.EscalateMinLv.ToShort());
                    dsItem1.PushIntoStack(magicLv.AbilityType.ToShort());
                    dsItem1.PushIntoStack(magicLv.EffectNum.ToNotNullString());
                    dsItem1.PushIntoStack(magicLv.GridMaxNum);

                    dsItem.PushIntoStack(dsItem1);
                }

                this.PushIntoStack(dsItem);
            }

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

示例13: BuildPacket

        public override void BuildPacket()
        {
            PushIntoStack(firstName.ToNotNullString());
            this.PushIntoStack((short)postType);
            this.PushIntoStack((short)isApply);
            this.PushIntoStack(fightList.Count);
            foreach (var fight in fightList)
            {
                CityInfo cityInfo = new ShareCacheStruct<CityInfo>().FindKey(fight.CityID);
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(fight.CityID);
                dsItem.PushIntoStack(cityInfo == null ? string.Empty : cityInfo.CityName.ToNotNullString());
                dsItem.PushIntoStack(fight.CityHead.ToNotNullString());
                dsItem.PushIntoStack((short)fight.GuildLv);
                dsItem.PushIntoStack(fight.SkillNum);
                this.PushIntoStack(dsItem);
            }
            this.PushIntoStack(currCityName.ToNotNullString());
            this.PushIntoStack(rewardDesc.ToNotNullString());
            this.PushIntoStack(guildName.ToNotNullString());
            this.PushIntoStack(endData);
            this.PushIntoStack((short)isChampion);


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

示例14: DailySportsRankPrize

        /// <summary>
        /// 竞技场每日奖励
        /// </summary>
        /// <param name="user"></param>
        public static void DailySportsRankPrize(GameUser user)
        {
            UserDailyRestrain dailyRestrain = new PersonalCacheStruct<UserDailyRestrain>().FindKey(user.UserID);
            if (IsGainSportsReward(user.UserID) && dailyRestrain != null && dailyRestrain.UserExtend != null)
            {
                //var envSet = ServerEnvSet.Get(ServerEnvKey.JingJiChangReward, "");
                SportsRewardInfo sportsInfo = new ShareCacheStruct<SportsRewardInfo>().FindKey(dailyRestrain.UserExtend.UserRankID);
                //if (envSet != null && sportsInfo != null && envSet.ToDateTime().Date > dailyRestrain.Funtion11.Date &&
                // dailyRestrain.UserExtend.UserRankID > 0)
                if (sportsInfo != null && DateTime.Now.Date != dailyRestrain.Funtion11.Date &&
                 dailyRestrain.UserExtend.UserRankID > 0)
                {
                    dailyRestrain.Funtion11 = DateTime.Now;
                    dailyRestrain.UserExtend.UserRankID = 0;

                    user.SportsIntegral = MathUtils.Addition(user.SportsIntegral, sportsInfo.RewardObtian,
                                                             int.MaxValue);
                    user.GameCoin = MathUtils.Addition(user.GameCoin, sportsInfo.RewardGoin, int.MaxValue);
                    string sportContent = string.Format(LanguageManager.GetLang().St5106_JingJiChangRankReward,
                                                        sportsInfo.RewardObtian, sportsInfo.RewardGoin);
                    var chatService = new TjxChatService();
                    chatService.SystemSendWhisper(user, sportContent);
                }
            }
        }
开发者ID:daneric,项目名称:Scut-samples,代码行数:29,代码来源:RankingHelper.cs

示例15: BuildPacket

        public override void BuildPacket()
        {
            this.PushIntoStack(TaskHelper.DailyEveryMaxNum);
            this.PushIntoStack(currNum);
            this.PushIntoStack(userTaskList.Count);
            foreach (UserTask userTask in userTaskList)
            {
                DailyTaskInfo dtaskInfo = new ShareCacheStruct<DailyTaskInfo>().FindKey(userTask.TaskID);
                var userItem = userTask.GetDailyItem(userLv);
                ItemBaseInfo itemInfo = new ShareCacheStruct<ItemBaseInfo>().FindKey(userItem != null ? userItem.ItemID : 0);

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(userTask.TaskID);
                dsItem.PushIntoStack(dtaskInfo.TaskName.ToNotNullString());
                dsItem.PushIntoStack((short)userTask.TaskState);
                dsItem.PushIntoStack((short)userTask.TaskType);
                dsItem.PushIntoStack((short)userTask.TaskStar);
                dsItem.PushIntoStack(dtaskInfo.TaskDescp.ToNotNullString());
                dsItem.PushIntoStack(dtaskInfo.TaskTarget);
                dsItem.PushIntoStack((int)userTask.TaskStar);
                dsItem.PushIntoStack(userTask.TaskTargetNum.ToInt());
                dsItem.PushIntoStack(userTask.GetDailyExpNum(userLv));
                dsItem.PushIntoStack(itemInfo != null ? itemInfo.ItemName.ToNotNullString() : string.Empty);
                dsItem.PushIntoStack(userItem != null ? userItem.Num : 0);

                this.PushIntoStack(dsItem);
            }

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


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