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


C# ShareCacheStruct.Update方法代码示例

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


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

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

示例2: Process


//.........这里部分代码省略.........
            }
            int expNum = 0;
            if (parameters["ExpNum"].Length > 0)
            {
                expNum = Convert.ToInt32(parameters["ExpNum"]);
            }
            int vipLv = 0;
            if (parameters["VipLv"].Length > 0)
            {
                vipLv = Convert.ToInt32(parameters["VipLv"]);
            }
            int gainBlessing = 0;
            if (parameters["GainBlessing"].Length > 0)
            {
                gainBlessing = Convert.ToInt32(parameters["GainBlessing"]);
            }
            int honourNum = 0;
            if (parameters["HonourNum"].Length > 0)
            {
                honourNum = Convert.ToInt32(parameters["HonourNum"]);
            }
            string mailContent = Convert.ToString(parameters["MailContent"]);
            int opUserID = Convert.ToInt32(parameters["OpUserID"]);
            //var cacheSetUserItem = new GameDataCacheSet<UserItemPackage>();
            var cacheSetItemInfo = new ShareCacheStruct<ItemBaseInfo>();
            var itemArray = itemPackage.Split(',');
            foreach (string str in UserList)
            {
                try
                {
                    int userID = str.Trim().ToInt();

                    var user = new GameDataCacheSet<GameUser>().FindKey(str);
                    if(user!=null)
                    {
                        user.GiftGold = MathUtils.Addition(user.GiftGold, gold);
                        user.ObtainNum = MathUtils.Addition(user.ObtainNum, obtainNum);
                        user.EnergyNum = MathUtils.Addition(user.EnergyNum, energyNum);
                        user.GameCoin = MathUtils.Addition(user.GameCoin, gameCoin);
                        user.ExpNum = MathUtils.Addition(user.ExpNum, expNum);
                        user.HonourNum = MathUtils.Addition(user.HonourNum, honourNum);
                    }

                    foreach (var item in itemArray)
                    {
                        if(item.Split('=').Length==2)
                        {
                            var itemInfo = cacheSetItemInfo.FindKey(item.Split('=')[0]);
                            if(itemInfo!=null)
                            {
                                UserItemHelper.AddUserItem(str, item.Split('=')[0].ToInt(), item.Split('=')[1].ToInt());
                            }
                        }
                    }
                    Guid newGuid = Guid.NewGuid();
                    UserTakePrize userPrizeLog = new UserTakePrize
                    {
                        ID = newGuid.ToString(),
                        UserID = userID,
                        ObtainNum = obtainNum,
                        EnergyNum = energyNum,
                        GameCoin = gameCoin,
                        Gold = gold,
                        ExpNum = expNum,
                        VipLv = vipLv,
                        GainBlessing = gainBlessing,
                        ItemPackage = itemPackage,
                        CrystalPackage = crystalList,
                        SparePackage = sparePackage,
                        EnchantPackage = enchantPackage,
                        MailContent = mailContent,
                        IsTasked = false,
                        TaskDate = MathUtils.SqlMinDate,
                        OpUserID = opUserID,
                        CreateDate = DateTime.Now,
                        HonourNum = honourNum,
                        Items = itemPackage,

                    };
                    var cacheSet = new ShareCacheStruct<UserTakePrize>();
                    cacheSet.Add(userPrizeLog, GameEnvironment.CacheGlobalPeriod);
                    cacheSet.Update();
                    PutCrystal(crystalList.Split(','), str);

                    // 发送系统信件
                    UserMail userMail = new UserMail(newGuid);
                    userMail.UserId = userID;
                    userMail.MailType = (int)MailType.System;
                    userMail.Title = LanguageManager.GetLang().St_SystemMailTitle;
                    userMail.Content = mailContent;
                    userMail.SendDate = DateTime.Now;
                    TjxMailService mailService=new TjxMailService(user);
                    mailService.Send(userMail);
                }
                catch (Exception ex)
                {
                    new BaseLog().SaveLog(ex);
                }
            }
        }
开发者ID:0jpq0,项目名称:Scut,代码行数:101,代码来源:UserPrizeProcesser.cs


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