还没有完全解决

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-09-23 04:15:29 +08:00
parent b65b860b98
commit 5384a31884
27 changed files with 70 additions and 54 deletions

View File

@@ -106,7 +106,7 @@ namespace JNGame.Sync.System.Data
base.OnUByteUpdate(bytes);
if (isServer)
{
OnDataSyncContext();
OnDataSyncContext(bytes);
}
}
@@ -206,11 +206,24 @@ namespace JNGame.Sync.System.Data
/// <summary>
/// 将数据Data同步到Context
/// </summary>
protected virtual void OnDataSyncContext()
protected virtual void OnDataSyncContext(Dictionary<ulong, byte[]> bytes = null)
{
Dictionary<ulong, T> lIsTileData = new Dictionary<ulong, T>(Data);
//同步删除
if (bytes is not null)
{
foreach (var keyValue in bytes)
{
E entity;
if (SDByteOperate.IsDelete(keyValue.Value) && (entity = NodeContext.Query(keyValue.Key)) is not null)
{
entity.Destroy();
}
}
}
NodeContext.GetEntities().ForEach(child =>
{
//如果有则删除