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


C# ShareCacheStruct.GetNextNo方法代码示例

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


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

示例1: TakeAction

 public override bool TakeAction()
 {
     var cache = new ShareCacheStruct<UserRanking>();
     var ranking = cache.Find(m => m.UserName == UserName);
     if (ranking == null)
     {
         var user = new GameUser() { UserId = (int)cache.GetNextNo(), NickName = UserName};
         new PersonalCacheStruct<GameUser>().Add(user);
         ranking = new UserRanking();
         ranking.UserID = user.UserId;
         ranking.UserName = UserName;
         ranking.Score = Score;
         if (!cache.Add(ranking))
         {
             ErrorCode = Language.Instance.ErrorCode;
             ErrorInfo = string.Format("add fail, UserID {0} is exist.", ranking.UserID);
             return false;
         }
     }
     else
     {
         ranking.UserName = UserName;
         ranking.Score = Score;
     }
     return true;
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:26,代码来源:Action1000.cs

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

示例3: InitNotice

 private void InitNotice()
 {
     var cacheSet = new ShareCacheStruct<Notice>();
     for (int i = 0; i < 5; i++)
     {
         int id = (int)cacheSet.GetNextNo();
         Notice notice = new Notice(id);
         notice.Title = "tile" + id;
         notice.Content = "Content" + id;
         notice.CreateDate = DateTime.Now;
         cacheSet.Add(notice);
     }
 }
开发者ID:rambo-long,项目名称:Scut,代码行数:13,代码来源:MainClass.cs

示例4: TakeAction

 public override bool TakeAction() {
     var cache = new ShareCacheStruct<UserRanking>();
     var ranking = cache.Find(m => m.UserName == userName);
     if (ranking == null) {
         var user = new GameUser() { UserId = (int)cache.GetNextNo(), NickName = userName };
         new PersonalCacheStruct<GameUser>().Add(user);
         ranking = new UserRanking();
         ranking.UserId = user.UserId;
         ranking.UserName = userName;
         ranking.Score = score;
         cache.Add(ranking);
     } else {
         ranking.UserName = userName;
         ranking.Score = score;
     }
     return true;
 }
开发者ID:daneric,项目名称:Scut,代码行数:17,代码来源:Action1000.cs

示例5: TakeAction

 public override bool TakeAction()
 {
     var cache = new ShareCacheStruct<UserRanking>();
     var ranking = cache.Find(m => m.UserName == UserName);
     if (ranking == null)
     {
         ranking = new UserRanking();
         ranking.UserID = (int)cache.GetNextNo();
         ranking.UserName = UserName;
         ranking.Score = Score;
         cache.Add(ranking);
     }
     else
     {
         ranking.UserName = UserName;
         ranking.Score = Score;
     }
     return true;
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:19,代码来源:Action1000.cs

示例6: TakeAction

 public override bool TakeAction()
 {
     var cache = new ShareCacheStruct<UserScore>();
     var ranking = cache.Find(m => m.username == _username);
     if (ranking == null)
     {
         var user = new User() { userid = (int)cache.GetNextNo(), nickname = _username };
         new PersonalCacheStruct<User>().Add(user);
         ranking = new UserScore();
         ranking.userid = user.userid;
         ranking.username = _username;
         ranking.score = _score;
         cache.Add(ranking);
     }
     else
     {
         ranking.username = _username;
         ranking.score = _score;
     }
     return true;
 }
开发者ID:kingzytgit,项目名称:scuttest,代码行数:21,代码来源:Action2003.cs

示例7: TakeAction

        public override bool TakeAction()
        {
            // 存入数据库
            var hmdCache = new PersonalCacheStruct<HappyModeData>();
            var cache    = new ShareCacheStruct<PayOrder>();
            int index = (int)cache.GetNextNo();
            PayOrder PayData    = new PayOrder();
            string ServerOrderId = System.Guid.NewGuid().ToString("N");
            int keyid = utils.KeyUInt2Int(requestPack.the3rdUserId);

            PayData.Index       = index;
            PayData.UserId      = requestPack.UserID;
            PayData.Identify    = requestPack.identify;
            PayData.typeUser    = requestPack.typeUser; // 360Pay..maybe
            PayData.ProductId   = requestPack.productId;
            PayData.num         = requestPack.num;
            PayData.the3rdUserId = keyid;// utils.KeyUInt2Int(requestPack.the3rdUserId);
            PayData.strThe3rdOrderId = requestPack.strThe3rdUserId;
            PayData.ServerOrderId = ServerOrderId;
            PayData.the3rdOrderId = "";
            cache.Add(PayData);

            // hmd persion
            HappyModeData hmd = hmdCache.FindKey(keyid.ToString());
            int happyPointMaxEnterNum = GameConfigMgr.Instance().getInt("happyPointMaxEnterNum", 3);
            if (null == hmd)
            {
                responsePack.errorCode = 1;
                return true;
            }
            PayOrderPersion pop = new PayOrderPersion();
            pop.Index = index;
            pop.UserId = requestPack.UserID;
            pop.Identify = requestPack.identify;
            pop.typeUser = requestPack.typeUser; // 360Pay..maybe
            pop.ProductId = requestPack.productId;
            pop.num = requestPack.num;
            pop.the3rdUsrID = (int)requestPack.the3rdUserId;// utils.KeyUInt2Int(requestPack.the3rdUserId);
            pop.strThe3rdOrderId = requestPack.strThe3rdUserId;
            pop.ServerOrderId = ServerOrderId;
            pop.the3rdOrderId = "";
            hmd.PayInfoDic.Add(ServerOrderId, pop);

            // end return
            responsePack.errorCode = 0;
            responsePack.typeUser  = requestPack.typeUser;
            responsePack.result    = PayData.ServerOrderId; // 服务器订单号

            ConsoleLog.showErrorInfo(0,"create order success"+requestPack.the3rdUserId+":"+ServerOrderId);
            return true;
        }
开发者ID:guccang,项目名称:scutlogic,代码行数:51,代码来源:Action1006.cs

示例8: InitNotices

 void InitNotices()
 {
     /*
      * new ShareCacheStruct<Notice> 实际上不是一个存储空间,
      * 而是指向redis数据库的一个入口,
      * 这里通过指定类型Notice来获得Notice表的指针,
      * 然后就可以做查询或修改操作
      *
      *     public abstract class BaseCacheStruct<T> : BaseDisposable where T : AbstractEntity, new()
      *     {
      *            static BaseCacheStruct()
      *            {
      *            // 这里根据<T>中的类型来确定表的名字,
      *            // 再根据T上面的EntityTable来确定连接的数据库,
      *            // [EntityTable(CacheType.Entity, "TestGameData")]
      *            //
      *            // 如果已经有表就操作表,没有就新建后操作,
      *            // 如果使用这个接口来将数据直接保存到sql数据库中的话,需要连接数据库,而且可能操作磁盘
      *                EntitySchemaSet.InitSchema(typeof(T));
      *                CacheFactory.RegistUpdateNotify(new DefaultCacheStruct<T>());
      *            }
      *           ...
      *     }
      */
     var cacheSet = new ShareCacheStruct<Notice>();
     for (int i = 0; i < 50; i++)
     {
         int id = (int)cacheSet.GetNextNo();
         Notice notice = new Notice(id);
         notice.title = "tile" + id;
         notice.content = "Content" + id;
         notice.time = DateTime.Now;
         cacheSet.Add(notice);
     }
 }
开发者ID:kingzytgit,项目名称:scuttest,代码行数:35,代码来源:MainClass.cs

示例9: addAuthory

 void addAuthory()
 {
     var cache = new ShareCacheStruct<Authority>();
     Authority au =  new Authority();
     au.id = (int)cache.GetNextNo();
     au.name = "guccang";
     au.pwd = ZyGames.Framework.Common.Security.CryptoHelper.MD5_Encrypt("[email protected]");
     au.level = 0xfffffff;
     cache.Add(au);
 }
开发者ID:guccang,项目名称:scutlogic,代码行数:10,代码来源:MainClass.cs

示例10: addLog

 void addLog(ShareCacheStruct<DataLog> cache, int userid, int dimond)
 {
     int index = (int)cache.GetNextNo();
     DataLog dl = new DataLog();
     dl.Index = index;
     dl.UserID = userid;
     dl.Dimond = dimond;
     cache.Add(dl);
 }
开发者ID:guccang,项目名称:scutlogic,代码行数:9,代码来源:Action1004.cs

示例11: TakeAction

        public override bool TakeAction()
        {
            int itemIndex = requestPack.realItemID;
            // int
            var happyPersionCache = new PersonalCacheStruct<HappyModeData>();
            int keyId = utils.KeyUInt2Int(requestPack.the3rdUserID);
            HappyModeData hmd =  happyPersionCache.FindKey(keyId.ToString());
            if(hmd == null)
            {
                responsePack.errorCode = (byte)Response1009Pack.EnumErrorCode.not_find_happymodedata;
                return true;
            }

            // happData 01
            memoryRealInfoDataModel.HappyData happyData = GameConfigMgr.Instance().getHappyData(requestPack.realItemID);
            if (null == happyData)
            {
                responsePack.errorCode = (byte)Response1009Pack.EnumErrorCode.not_find_happPointConfig;
                return true;
            }

            // share realitem modify 02
            var itemcntCache = new ShareCacheStruct<ShareRealItemCnt>();
            ShareRealItemCnt sric = itemcntCache.FindKey(requestPack.realItemID);
            if(null == sric)
            {
                responsePack.errorCode = (byte)Response1009Pack.EnumErrorCode.not_find_item_cnt_data;
                return true;
            }

            if(false == checkRefleshReplace(hmd,happyData))
            {
                return true;
            }

            int needHappyPoint = happyData.needHappyPoint; // 配置文件总获得
            if (hmd.HappyPoint < needHappyPoint)
            {
                responsePack.errorCode = (byte)Response1009Pack.EnumErrorCode.not_enought_happyPoint;
                return true;
            }

            if(sric.num <= 0)
            {
                responsePack.errorCode = (byte)Response1009Pack.EnumErrorCode.realitem_is_empty;
                return true;
            }

            bool buyOK = false;
            if(sric.num>0)
            {
                sric.ModifyLocked(() =>
                {
                    sric.num -= 1;
                    if (sric.num >= 0)
                        buyOK = true;
                });
            }

            if (false == buyOK)
            {
                responsePack.errorCode = (byte)Response1009Pack.EnumErrorCode.realitem_is_empty;
                return true;
            }

            persionRealItemInfo rii = new persionRealItemInfo();
            rii.Index = hmd.RealItemInfoLst.Count;
            rii.UserId = requestPack.UserID;
            rii.the3rdUserId = utils.KeyUInt2Int( requestPack.the3rdUserID);
            rii.Identify = requestPack.identify;
            rii.happyPoint = hmd.HappyPoint;
            rii.needHappyPoint = needHappyPoint;
            rii.realItemID = requestPack.realItemID;
            hmd.RealItemInfoLst.Add(rii);

            // save to db for ....
            var shareRealItemCache = new ShareCacheStruct<shareRealItemInfo>();
            shareRealItemInfo shareRII = new shareRealItemInfo();
            shareRII.Index = (int)shareRealItemCache.GetNextNo();
            shareRII.UserId = requestPack.UserID;
            shareRII.the3rdUserId = utils.KeyUInt2Int( requestPack.the3rdUserID);
            shareRII.Identify = requestPack.identify;
            shareRII.happyPoint = hmd.HappyPoint;
            shareRII.needHappyPoint = needHappyPoint;
            shareRII.realItemID = requestPack.realItemID;
            shareRealItemCache.Add(shareRII);

            hmd.ModifyLocked(() =>
            {
                hmd.HappyPoint -= needHappyPoint;
                hmd.realItemBuyCntInRefleshTime[itemIndex].cnt = hmd.realItemBuyCntInRefleshTime[itemIndex].cnt + 1;
            });
            responsePack.errorCode  = (byte)Response1009Pack.EnumErrorCode.ok;
            responsePack.realItemID = rii.realItemID;
            return true;
        }
开发者ID:guccang,项目名称:scutlogic,代码行数:96,代码来源:Action1009.cs

示例12: cbFunc

        static Response1001Pack cbFunc(object obj)
        {
            List<object> objList = obj as List<object>;
            if (objList.Count != 2) return null;
            List<UserRanking> rankingList = objList[1] as List<UserRanking>;

            // save to ....where....
            var shareCache = new ShareCacheStruct<HistoryUserRanking>();
            int num = (int)shareCache.GetNextNo();
            var saveData = new HistoryUserRanking();
            saveData.ID = num;
            // get data
            if (rankingList.Count >= 3)
            {
                UserRanking first = rankingList[0];
                UserRanking second = rankingList[1];
                UserRanking thrid = rankingList[2];

                saveData.Items.Add(first);
                saveData.Items.Add(second);
                saveData.Items.Add(thrid);
            }
            shareCache.Add(saveData);

            return null;
        }
开发者ID:guccang,项目名称:scutlogic,代码行数:26,代码来源:RankingClear.cs


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