本文整理汇总了C#中PersonalCacheStruct.GetNextNo方法的典型用法代码示例。如果您正苦于以下问题:C# PersonalCacheStruct.GetNextNo方法的具体用法?C# PersonalCacheStruct.GetNextNo怎么用?C# PersonalCacheStruct.GetNextNo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersonalCacheStruct
的用法示例。
在下文中一共展示了PersonalCacheStruct.GetNextNo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameUserProcess
bool GameUserProcess(GameUser gu, bool checkDataOk)
{
var persionCache = new PersonalCacheStruct<GameUser>();
if (requestPack.UserID <= 0)
{
gu.UserId = (int)persionCache.GetNextNo();
persionCache.Add(gu);
}
else
{
if (checkDataOk)
{
GameUser findGU = persionCache.FindKey(requestPack.UserID.ToString());
if (null == findGU) // maybe create by happyPoint
{
persionCache.Add(gu);
}
else if (requestPack.Score > findGU.Score)
{
findGU.ModifyLocked(() =>
{
findGU.NickName = gu.NickName;
findGU.Score = gu.Score;
findGU.state = gu.state;
findGU.version = gu.version;
});
}
}
}
return true;
}
示例2: TakeAction
public override bool TakeAction()
{
if(requestPack.UserID <0 )
{
var cache = new PersonalCacheStruct<GameUser>();
int UserId = (int)cache.GetNextNo();
GameUser gu = new GameUser();
gu.UserId = UserId;
gu.Identify = requestPack.identify;
gu.version = requestPack.version;
}
Action3000Data d = new Action3000Data();
d.data = int.MaxValue;
responsePack.int_test = int.MaxValue;
responsePack.float_test = 1.0f;
responsePack.uint_test = uint.MaxValue;
responsePack.list_int_test = new List<int>();
responsePack.list_class_test = new List<Action3000Data>();
responsePack.dic_int_test = new Dictionary<int, int>();
responsePack.dic_class_test = new Dictionary<int, Action3000Data>();
responsePack.list_int_test.Add(int.MaxValue);
responsePack.list_class_test.Add(d);
responsePack.dic_int_test.Add(0, int.MaxValue);
responsePack.dic_class_test.Add(0, d);
responsePack.ErrorCode = (int)GameErrorCode.Error_3000_Test01;
//responsePack.dic_class_test[1].data = 2;
return true;
}
示例3: processAdd
string processAdd(string parm)
{
string info = "";
string[] p = parm.Split(',');
string addWhich = p[0];
string name = p[1];
int score = int.Parse(p[2]) ;
if("ranking"==addWhich)
{
var cache = new PersonalCacheStruct<GameUser>();
var urCache =new ShareCacheStruct<UserRanking>();
var gu = new GameUser();
gu.UserId = (int)cache.GetNextNo();
gu.NickName = name;
gu.Score = score;
gu.Identify = "identify_"+name;
var ur = new UserRanking();
ur.UserID = gu.UserId;
ur.UserName = name;
ur.Score = score;
cache.Add(gu);
urCache.Add(ur);
info = "增加排行榜数据成功";
}
return info;
}
示例4: CreateUserRole
protected override bool CreateUserRole(out IUser user)
{
user = null;
if (UserName.Length < 2 || UserName.Length > 12)
{
ErrorCode = Language.Instance.ErrorCode;
ErrorInfo = Language.Instance.St1005_UserNameNotEnough;
return false;
}
var userCache = new PersonalCacheStruct<GameUserCopy>();
var roleCache = new PersonalCacheStruct<UserRole>();
var userNameCache = new PersonalCacheStruct<UserDescription>();
GameUserCopy gameUser;
if (userCache.TryFindKey(Pid, out gameUser) == LoadingStatus.Success)
{
if (gameUser == null)
{
gameUser = new GameUserCopy
{
UserId = UserId,
PassportId = Pid,
RetailId = RetailID,
NickName = Pid
};
userCache.Add(gameUser);
}
user =new SessionUser(gameUser);
/////////////////Test////////////////////////////
UserDescription description;
if (userNameCache.TryFind(gameUser.PersonalId, r => r.UserId == gameUser.UserId, out description) == LoadingStatus.Success)
{
if (description == null)
{
}
}
////////////////////////////////////////////////////
UserRole role;
if (roleCache.TryFind(gameUser.PersonalId, r => r.RoleName == UserName, out role) == LoadingStatus.Success)
{
if (role == null)
{
role = new UserRole()
{
RoleId = (int)roleCache.GetNextNo(),
UserId = UserId,
RoleName = UserName,
HeadImg = HeadID,
Sex = Sex.ToBool(),
LvNum = 1,
ExperienceNum = 0,
LifeNum = 100,
LifeMaxNum = 100
};
roleCache.Add(role);
gameUser.CurrRoleId = role.RoleId;
}
return true;
}
}
return false;
}
示例5: getHappyIndex
// caret map . the3rdUserid and happyData....
public static int getHappyIndex(string type, string id)
{
var happMapCache = new PersonalCacheStruct<The3rdUserIDMap>();
var map = happMapCache.FindKey("888");
int index = -1;
string mapKey = getMapKey(type, id);
if (false == map.the3rdMap.ContainsKey(mapKey))
{
var happyCache = new PersonalCacheStruct<HappyModeData>();
var hmd = new HappyModeData();
hmd.the3rdUserId = (int)happyCache.GetNextNo() + 10000;
int maxEnterNum = GameConfigMgr.Instance().getInt("happyPointMaxEnterNum", 3);
hmd.EnterNum = maxEnterNum;
happyCache.Add(hmd);
map.ModifyLocked(() =>
{
map.the3rdMap.Add(mapKey, hmd.the3rdUserId);
});
index = hmd.the3rdUserId;
}
else
{
index = map.the3rdMap[mapKey];
}
return index;
}
示例6: TakeAction
public override bool TakeAction()
{
if(requestPack.UserID<=0)
{
var persionCache = new PersonalCacheStruct<GameUser>();
GameUser gu = new GameUser();
gu.UserId = (int)persionCache.GetNextNo();
gu.CreateTime = System.DateTime.Now;
gu.CompensationDate = gu.CreateTime;
gu.NickName = "";
gu.Identify = requestPack.identify;
gu.version = "1.09";
persionCache.Add(gu);
//
theUserId = gu.UserId;
}
else
{
theUserId = requestPack.UserID;
}
version = requestPack.version;
//ConsoleLog.showErrorInfo(0, "acton1005:userid:"+requestPack.UserID+"#version:"+requestPack.version);
if (requestPack.typeUser == "YYS_CP360")
{
Pay360();
}
else if (requestPack.typeUser == "YYS_BaiDu")
{
PayBaiDu();
}
else
{
responsePack.errorCode = (byte)Response1005Pack.EnumErrorCode.not_find_typeUser;
}
return true;
}
示例7: TakeAction
public override bool TakeAction()
{
// 存入数据库
var cache = new PersonalCacheStruct<HappyModeData>();
ConsoleLog.showErrorInfo(0, "index:" + cache.GetNextNo());
int keyid = utils.KeyUInt2Int(requestPack.the3rdUserID);
HappyModeData hmd = cache.FindKey(keyid.ToString());
int happyPointMaxEnterNum = GameConfigMgr.Instance().getInt("happyPointMaxEnterNum", 3);
if (null == hmd)
{
responsePack.errorCode = (byte)Response1007Pack.EnumErrorCode.not_findHMD;
return true;
}
doRefleshEnterTimer(hmd); // 刷新enterNum
responsePack.errorCode = (byte)Response1007Pack.EnumErrorCode.ok;
responsePack.enterNum = hmd.EnterNum;
responsePack.happyPoint = hmd.HappyPoint;
responsePack.happyReLiveNum = hmd.HappyReliveNum;
responsePack.maxEnterNum = happyPointMaxEnterNum;
if (requestPack.dateType != 1) return true; // not return realitem infos
foreach (var rii in hmd.RealItemInfoLst)
{
Action1007RealItem timeInfo = new Action1007RealItem();
timeInfo.id = rii.realItemID;
timeInfo.theTime = rii.CreateDate;
responsePack.realItemsIds.Add(timeInfo);
}
return true;
}