【m】1111

This commit is contained in:
2025-09-23 11:18:38 +08:00
parent b04e548850
commit a2e0062a34
202 changed files with 13296 additions and 56 deletions

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
namespace Stary.Evo
{
public class TreeNode
{
public Dictionary<ulong, TreeNode> childs;
public ulong id;
public object data;
public TreeNode Get(ulong id)
{
if (childs == null)
{
return null;
}
childs.TryGetValue(id, out var node);
return node;
}
public TreeNode GetOrAdd(ulong id)
{
if (childs == null)
{
childs = new Dictionary<ulong, TreeNode>();
}
if (!childs.TryGetValue(id, out var node))
{
node = ObjectPool<TreeNode>.Get();
node.id = id;
childs.Add(id, node);
}
return node;
}
public void CleanUp()
{
if (childs != null)
{
foreach (var item in childs.Values)
{
item.CleanUp();
ObjectPool<TreeNode>.Release(item);
}
childs.Clear();
}
id = 0;
data = default;
}
}
}