mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交无缝数据回滚
This commit is contained in:
@@ -16,9 +16,9 @@ namespace JNGame.Sync.Frame.Service
|
||||
private Func<int,int,int> nRandomInt;
|
||||
|
||||
//Id
|
||||
private long _id = 0;
|
||||
private long _idMin = long.MinValue;
|
||||
private long _idMax = long.MaxValue;
|
||||
private ulong _id = 0;
|
||||
private ulong _idMin = ulong.MinValue;
|
||||
private ulong _idMax = ulong.MaxValue;
|
||||
|
||||
public JNRandomSystem(int seed)
|
||||
{
|
||||
@@ -41,12 +41,12 @@ namespace JNGame.Sync.Frame.Service
|
||||
return nRandomInt(max,min);
|
||||
}
|
||||
|
||||
public long NextId()
|
||||
public ulong NextId()
|
||||
{
|
||||
return ++_id;
|
||||
}
|
||||
|
||||
public void SetIdValue(long min,long max)
|
||||
public void SetIdValue(ulong min,ulong max)
|
||||
{
|
||||
if (_id < min)
|
||||
{
|
||||
@@ -55,21 +55,5 @@ namespace JNGame.Sync.Frame.Service
|
||||
_idMin = min;
|
||||
_idMax = max;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 适配Id 用于 历史Id和新Id重复问题
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public void AdaptId(long id)
|
||||
{
|
||||
if (_idMin <= id && id >= _idMax)
|
||||
{
|
||||
if (id > _id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user