1.重名所有App级模块为Service 2.移除Module中心 移除SingletonManager 3.引入Service Scope Context概念 避免上下文Manager到处引用 4.修复部分bug
83 lines
4.0 KiB
C#
83 lines
4.0 KiB
C#
using AlicizaX.ObjectPool;
|
|
using UnityEngine;
|
|
|
|
namespace AlicizaX.Debugger.Runtime
|
|
{
|
|
public sealed partial class DebuggerComponent
|
|
{
|
|
private sealed class ObjectPoolInformationWindow : ScrollableDebuggerWindowBase
|
|
{
|
|
private IObjectPoolService m_ObjectPoolService = null;
|
|
|
|
public override void Initialize(params object[] args)
|
|
{
|
|
m_ObjectPoolService = AppServices.Require<IObjectPoolService>();
|
|
}
|
|
|
|
protected override void OnDrawScrollableWindow()
|
|
{
|
|
GUILayout.Label("<b>Object Pool Information</b>");
|
|
GUILayout.BeginVertical("box");
|
|
{
|
|
DrawItem("Object Pool Count", m_ObjectPoolService.Count.ToString());
|
|
}
|
|
GUILayout.EndVertical();
|
|
ObjectPoolBase[] objectPools = m_ObjectPoolService.GetAllObjectPools(true);
|
|
for (int i = 0; i < objectPools.Length; i++)
|
|
{
|
|
DrawObjectPool(objectPools[i]);
|
|
}
|
|
}
|
|
|
|
private void DrawObjectPool(ObjectPoolBase objectPool)
|
|
{
|
|
GUILayout.Label(Utility.Text.Format("<b>Object Pool: {0}</b>", objectPool.FullName));
|
|
GUILayout.BeginVertical("box");
|
|
{
|
|
DrawItem("Name", objectPool.Name);
|
|
DrawItem("Type", objectPool.ObjectType.FullName);
|
|
DrawItem("Auto Release Interval", objectPool.AutoReleaseInterval.ToString());
|
|
DrawItem("Capacity", objectPool.Capacity.ToString());
|
|
DrawItem("Used Count", objectPool.Count.ToString());
|
|
DrawItem("Can Release Count", objectPool.CanReleaseCount.ToString());
|
|
DrawItem("Expire Time", objectPool.ExpireTime.ToString());
|
|
DrawItem("Priority", objectPool.Priority.ToString());
|
|
ObjectInfo[] objectInfos = objectPool.GetAllObjectInfos();
|
|
GUILayout.BeginHorizontal();
|
|
{
|
|
GUILayout.Label("<b>Name</b>");
|
|
GUILayout.Label("<b>Locked</b>", GUILayout.Width(60f));
|
|
GUILayout.Label(objectPool.AllowMultiSpawn ? "<b>Count</b>" : "<b>In Use</b>", GUILayout.Width(60f));
|
|
GUILayout.Label("<b>Flag</b>", GUILayout.Width(60f));
|
|
GUILayout.Label("<b>Priority</b>", GUILayout.Width(60f));
|
|
GUILayout.Label("<b>Last Use Time</b>", GUILayout.Width(120f));
|
|
}
|
|
GUILayout.EndHorizontal();
|
|
|
|
if (objectInfos.Length > 0)
|
|
{
|
|
for (int i = 0; i < objectInfos.Length; i++)
|
|
{
|
|
GUILayout.BeginHorizontal();
|
|
{
|
|
GUILayout.Label(string.IsNullOrEmpty(objectInfos[i].Name) ? "<None>" : objectInfos[i].Name);
|
|
GUILayout.Label(objectInfos[i].Locked.ToString(), GUILayout.Width(60f));
|
|
GUILayout.Label(objectPool.AllowMultiSpawn ? objectInfos[i].SpawnCount.ToString() : objectInfos[i].IsInUse.ToString(), GUILayout.Width(60f));
|
|
GUILayout.Label(objectInfos[i].CustomCanReleaseFlag.ToString(), GUILayout.Width(60f));
|
|
GUILayout.Label(objectInfos[i].Priority.ToString(), GUILayout.Width(60f));
|
|
GUILayout.Label(objectInfos[i].LastUseTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), GUILayout.Width(120f));
|
|
}
|
|
GUILayout.EndHorizontal();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GUILayout.Label("<i>Object Pool is Empty ...</i>");
|
|
}
|
|
}
|
|
GUILayout.EndVertical();
|
|
}
|
|
}
|
|
}
|
|
}
|