mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交无缝数据回滚
This commit is contained in:
@@ -45,12 +45,12 @@ namespace JNGame.Sync.System.Data
|
||||
/// <summary>
|
||||
/// 插入字节
|
||||
/// </summary>
|
||||
public void OnInsertUBytes(Dictionary<long, byte[]> bytes);
|
||||
public void OnInsertUBytes(Dictionary<ulong, byte[]> bytes);
|
||||
|
||||
/// <summary>
|
||||
/// 获取全部字节
|
||||
/// </summary>
|
||||
public Dictionary<long, byte[]> GetDataBytes();
|
||||
public Dictionary<ulong, byte[]> GetDataBytes();
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace JNGame.Sync.System.Data
|
||||
public abstract int NetID { get; }
|
||||
|
||||
//网络通讯的更新字节数据
|
||||
protected Dictionary<long, byte[]> UBytes = new();
|
||||
protected Dictionary<ulong, byte[]> UBytes = new();
|
||||
|
||||
public SStateDataEnum Type;
|
||||
|
||||
@@ -117,13 +117,13 @@ namespace JNGame.Sync.System.Data
|
||||
/// </summary>
|
||||
/// <param name="bytes"></param>
|
||||
/// <returns>是否清空UBytes</returns>
|
||||
public abstract void OnSendUBytes(Dictionary<long, byte[]> bytes);
|
||||
public abstract void OnSendUBytes(Dictionary<ulong, byte[]> bytes);
|
||||
|
||||
/// <summary>
|
||||
/// 插入字节
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void OnInsertUBytes(Dictionary<long, byte[]> bytes)
|
||||
public void OnInsertUBytes(Dictionary<ulong, byte[]> bytes)
|
||||
{
|
||||
//提交数据更新
|
||||
OnUByteUpdate(bytes);
|
||||
@@ -132,9 +132,9 @@ namespace JNGame.Sync.System.Data
|
||||
/// <summary>
|
||||
/// 获取全部字节
|
||||
/// </summary>
|
||||
public Dictionary<long, byte[]> GetDataBytes()
|
||||
public Dictionary<ulong, byte[]> GetDataBytes()
|
||||
{
|
||||
var data = new Dictionary<long, byte[]>();
|
||||
var data = new Dictionary<ulong, byte[]>();
|
||||
|
||||
lock (Data)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ namespace JNGame.Sync.System.Data
|
||||
/// <summary>
|
||||
/// 将UByte提交更新
|
||||
/// </summary>
|
||||
public virtual void OnUByteUpdate(Dictionary<long, byte[]> bytes)
|
||||
public virtual void OnUByteUpdate(Dictionary<ulong, byte[]> bytes)
|
||||
{
|
||||
lock (Data)
|
||||
{
|
||||
@@ -187,7 +187,7 @@ namespace JNGame.Sync.System.Data
|
||||
/// <param name="id"></param>
|
||||
/// <param name="bytes"></param>
|
||||
/// <returns></returns>
|
||||
public T NewObject(long id,byte[] bytes)
|
||||
public T NewObject(ulong id,byte[] bytes)
|
||||
{
|
||||
var data = new T();
|
||||
data.Id = id;
|
||||
@@ -225,7 +225,7 @@ namespace JNGame.Sync.System.Data
|
||||
/// <summary>
|
||||
/// 删除数据
|
||||
/// </summary>
|
||||
public virtual void Delete(long id)
|
||||
public virtual void Delete(ulong id)
|
||||
{
|
||||
UBytes[id] = SDByteOperate.DELETE;
|
||||
}
|
||||
|
@@ -21,13 +21,13 @@ namespace JNGame.Sync.System.Data
|
||||
/// <summary>
|
||||
/// 获取有权限的全部字节
|
||||
/// </summary>
|
||||
public Dictionary<long, byte[]> GetHostDataBytes();
|
||||
public Dictionary<ulong, byte[]> GetHostDataBytes();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定区块的全部字节
|
||||
/// </summary>
|
||||
public Dictionary<long, byte[]> GetTileDataBytes(int index);
|
||||
public Dictionary<ulong, byte[]> GetTileDataBytes(int index);
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace JNGame.Sync.System.Data
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnUByteUpdate(Dictionary<long, byte[]> bytes)
|
||||
public override void OnUByteUpdate(Dictionary<ulong, byte[]> bytes)
|
||||
{
|
||||
base.OnUByteUpdate(bytes);
|
||||
if (isServer)
|
||||
@@ -83,11 +83,11 @@ namespace JNGame.Sync.System.Data
|
||||
protected virtual void OnDataSyncContext()
|
||||
{
|
||||
|
||||
Dictionary<long, T> lIsTileData;
|
||||
Dictionary<ulong, T> lIsTileData;
|
||||
|
||||
lock (Data)
|
||||
{
|
||||
lIsTileData = new Dictionary<long, T>(Data);
|
||||
lIsTileData = new Dictionary<ulong, T>(Data);
|
||||
}
|
||||
|
||||
NodeContext.GetEntities().ForEach(child =>
|
||||
@@ -155,7 +155,7 @@ namespace JNGame.Sync.System.Data
|
||||
{
|
||||
|
||||
//需要删除的数据Id
|
||||
var ids = new List<long>();
|
||||
var ids = new List<ulong>();
|
||||
|
||||
Data.ForEach(child =>
|
||||
{
|
||||
@@ -175,10 +175,10 @@ namespace JNGame.Sync.System.Data
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<long, byte[]> GetHostDataBytes()
|
||||
public Dictionary<ulong, byte[]> GetHostDataBytes()
|
||||
{
|
||||
|
||||
var data = new Dictionary<long, byte[]>();
|
||||
var data = new Dictionary<ulong, byte[]>();
|
||||
|
||||
lock (Data)
|
||||
{
|
||||
@@ -195,10 +195,10 @@ namespace JNGame.Sync.System.Data
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<long, byte[]> GetTileDataBytes(int index)
|
||||
public Dictionary<ulong, byte[]> GetTileDataBytes(int index)
|
||||
{
|
||||
|
||||
var data = new Dictionary<long, byte[]>();
|
||||
var data = new Dictionary<ulong, byte[]>();
|
||||
|
||||
lock (Data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user