2026-03-26 16:14:05 +08:00
|
|
|
using AlicizaX.ObjectPool;
|
2025-09-05 19:46:30 +08:00
|
|
|
using UnityEngine;
|
2026-04-21 13:01:55 +08:00
|
|
|
using UnityEngine.UIElements;
|
2025-09-05 19:46:30 +08:00
|
|
|
|
|
|
|
|
namespace AlicizaX.Debugger.Runtime
|
|
|
|
|
{
|
|
|
|
|
public sealed partial class DebuggerComponent
|
|
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
private sealed class ObjectPoolInformationWindow : PollingDebuggerWindowBase
|
2025-09-05 19:46:30 +08:00
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
private IObjectPoolService m_ObjectPoolService;
|
2025-09-05 19:46:30 +08:00
|
|
|
|
|
|
|
|
public override void Initialize(params object[] args)
|
|
|
|
|
{
|
2026-03-26 16:14:05 +08:00
|
|
|
m_ObjectPoolService = AppServices.Require<IObjectPoolService>();
|
2025-09-05 19:46:30 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-21 13:01:55 +08:00
|
|
|
protected override void BuildWindow(VisualElement root)
|
2025-09-05 19:46:30 +08:00
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
if (m_ObjectPoolService == null)
|
2025-09-05 19:46:30 +08:00
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
return;
|
2025-09-05 19:46:30 +08:00
|
|
|
}
|
2026-04-21 13:01:55 +08:00
|
|
|
|
|
|
|
|
VisualElement overview = CreateSection("Object Pool Overview", out VisualElement overviewCard);
|
|
|
|
|
overviewCard.Add(CreateRow("Object Pool Count", m_ObjectPoolService.Count.ToString()));
|
|
|
|
|
root.Add(overview);
|
|
|
|
|
|
2026-03-26 16:14:05 +08:00
|
|
|
ObjectPoolBase[] objectPools = m_ObjectPoolService.GetAllObjectPools(true);
|
2025-09-05 19:46:30 +08:00
|
|
|
for (int i = 0; i < objectPools.Length; i++)
|
|
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
ObjectPoolBase objectPool = objectPools[i];
|
|
|
|
|
VisualElement section = CreateSection(Utility.Text.Format("Object Pool: {0}", objectPool.FullName), out VisualElement card);
|
|
|
|
|
card.Add(CreateRow("Name", objectPool.Name));
|
|
|
|
|
card.Add(CreateRow("Type", objectPool.ObjectType.FullName));
|
|
|
|
|
card.Add(CreateRow("Auto Release Interval", objectPool.AutoReleaseInterval.ToString()));
|
|
|
|
|
card.Add(CreateRow("Capacity", objectPool.Capacity.ToString()));
|
|
|
|
|
card.Add(CreateRow("Used Count", objectPool.Count.ToString()));
|
|
|
|
|
card.Add(CreateRow("Can Release Count", objectPool.CanReleaseCount.ToString()));
|
|
|
|
|
card.Add(CreateRow("Expire Time", objectPool.ExpireTime.ToString()));
|
|
|
|
|
card.Add(CreateRow("Priority", objectPool.Priority.ToString()));
|
2025-09-05 19:46:30 +08:00
|
|
|
|
|
|
|
|
ObjectInfo[] objectInfos = objectPool.GetAllObjectInfos();
|
2026-04-21 13:01:55 +08:00
|
|
|
if (objectInfos.Length <= 0)
|
2025-09-05 19:46:30 +08:00
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
card.Add(CreateRow("Entries", "Object Pool is Empty ..."));
|
2025-09-05 19:46:30 +08:00
|
|
|
}
|
2026-04-21 13:01:55 +08:00
|
|
|
else
|
2025-09-05 19:46:30 +08:00
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
for (int j = 0; j < objectInfos.Length; j++)
|
2025-09-05 19:46:30 +08:00
|
|
|
{
|
2026-04-21 13:01:55 +08:00
|
|
|
ObjectInfo info = objectInfos[j];
|
|
|
|
|
string title = string.IsNullOrEmpty(info.Name) ? "<None>" : info.Name;
|
|
|
|
|
string content = Utility.Text.Format(
|
|
|
|
|
"Locked {0} | {1} {2} | Flag {3} | Priority {4} | Last Use {5}",
|
|
|
|
|
info.Locked,
|
|
|
|
|
objectPool.AllowMultiSpawn ? "Count" : "InUse",
|
|
|
|
|
objectPool.AllowMultiSpawn ? info.SpawnCount.ToString() : info.IsInUse.ToString(),
|
|
|
|
|
info.CustomCanReleaseFlag,
|
|
|
|
|
info.Priority,
|
|
|
|
|
info.LastUseTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
card.Add(CreateRow(title, content));
|
2025-09-05 19:46:30 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-04-21 13:01:55 +08:00
|
|
|
|
|
|
|
|
root.Add(section);
|
2025-09-05 19:46:30 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|