JisolGame/JNFrame2/Assets/Scripts/Game/Data/EDNodeDataSystem.cs

65 lines
1.5 KiB
C#
Raw Normal View History

2024-08-17 14:27:18 +08:00
using System;
using System.Collections.Generic;
using System.Text;
2024-08-22 20:37:39 +08:00
using AppGame;
2024-08-17 14:27:18 +08:00
using DotRecast.Core.Collections;
using Entitas;
using Game.JNGFrame.Logic.Entity;
using Game.JNGFrame.Logic.Entity.Contexts;
using JNGame.Math;
using JNGame.Sync.State.Tile.Entity;
using JNGame.Sync.System;
using JNGame.Sync.System.Data;
using Newtonsoft.Json;
using UnityEngine;
namespace Game.JNGState.Logic.Data
{
2024-08-22 20:37:39 +08:00
2024-08-17 14:27:18 +08:00
[Serializable]
2024-08-22 20:37:39 +08:00
public class EDNodeValue : GDataValue
2024-08-17 14:27:18 +08:00
{
2024-08-22 20:37:39 +08:00
2024-08-17 14:27:18 +08:00
}
2024-08-22 20:37:39 +08:00
public class EDNodeData : GDataBase<EDNodeData,EDNodeValue,EDNode>
2024-08-17 14:27:18 +08:00
{
2024-08-22 20:37:39 +08:00
2024-08-17 14:27:18 +08:00
public EDNodeData()
{
}
2024-08-22 20:37:39 +08:00
public EDNodeData(EDNode node) : base(node)
2024-08-17 14:27:18 +08:00
{
}
2024-08-22 20:37:39 +08:00
2024-08-17 14:27:18 +08:00
}
2024-08-22 20:37:39 +08:00
public class EDNodeDataSystem : GDataBaseSystem<EDNodeData,EDNode>
2024-08-17 14:27:18 +08:00
{
public EDNodeDataSystem(SStateDataEnum type) : base(type)
{
}
public override JNTileContext<EDNode> NodeContext => Contexts.GetContext<EDNodeContext>();
public override int NetID => (int)NetDataEnum.EDNodeData;
2024-08-23 10:48:19 +08:00
public override Dictionary<ulong, EDNodeData> GetLatest()
2024-08-17 14:27:18 +08:00
{
2024-08-23 10:48:19 +08:00
var nodes = new Dictionary<ulong, EDNodeData>();
2024-08-17 14:27:18 +08:00
NodeContext.GetEntities().ForEach(child =>
{
2024-08-21 16:18:52 +08:00
if (nodes.ContainsKey(child.Id))
{
Debug.Log($"[EDNodeDataSystem] 出错 发现重复Key");
return;
}
2024-08-17 14:27:18 +08:00
nodes.Add(child.Id,new EDNodeData(child));
});
return nodes;
}
}
}