mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Debugger Add ObjectPoolInfomationWindow
This commit is contained in:
@@ -0,0 +1,87 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TEngine
|
||||||
|
{
|
||||||
|
public sealed partial class Debugger
|
||||||
|
{
|
||||||
|
private sealed class ObjectPoolInformationWindow : ScrollableDebuggerWindowBase
|
||||||
|
{
|
||||||
|
private IObjectPoolModule _objectPool = null;
|
||||||
|
|
||||||
|
public override void Initialize(params object[] args)
|
||||||
|
{
|
||||||
|
_objectPool = ModuleSystem.GetModule<IObjectPoolModule>();
|
||||||
|
if (_objectPool == null)
|
||||||
|
{
|
||||||
|
Log.Fatal("Object pool component is invalid.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDrawScrollableWindow()
|
||||||
|
{
|
||||||
|
GUILayout.Label("<b>Object Pool Information</b>");
|
||||||
|
GUILayout.BeginVertical("box");
|
||||||
|
{
|
||||||
|
DrawItem("Object Pool Count", _objectPool.Count.ToString());
|
||||||
|
}
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
ObjectPoolBase[] objectPools = _objectPool.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(CultureInfo.InvariantCulture));
|
||||||
|
DrawItem("Capacity", objectPool.Capacity.ToString());
|
||||||
|
DrawItem("Used Count", objectPool.Count.ToString());
|
||||||
|
DrawItem("Can Release Count", objectPool.CanReleaseCount.ToString());
|
||||||
|
DrawItem("Expire Time", objectPool.ExpireTime.ToString(CultureInfo.InvariantCulture));
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 14e7f9db9d50d314186ed2e6ab3415fa
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -77,6 +77,7 @@ namespace TEngine
|
|||||||
private RuntimeMemoryInformationWindow<Font> _runtimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow<Font>();
|
private RuntimeMemoryInformationWindow<Font> _runtimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow<Font>();
|
||||||
private RuntimeMemoryInformationWindow<TextAsset> _runtimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow<TextAsset>();
|
private RuntimeMemoryInformationWindow<TextAsset> _runtimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow<TextAsset>();
|
||||||
private RuntimeMemoryInformationWindow<ScriptableObject> _runtimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow<ScriptableObject>();
|
private RuntimeMemoryInformationWindow<ScriptableObject> _runtimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow<ScriptableObject>();
|
||||||
|
private ObjectPoolInformationWindow _objectPoolInformationWindow = new ObjectPoolInformationWindow();
|
||||||
private MemoryPoolPoolInformationWindow _memoryPoolPoolInformationWindow = new MemoryPoolPoolInformationWindow();
|
private MemoryPoolPoolInformationWindow _memoryPoolPoolInformationWindow = new MemoryPoolPoolInformationWindow();
|
||||||
private SettingsWindow _settingsWindow = new SettingsWindow();
|
private SettingsWindow _settingsWindow = new SettingsWindow();
|
||||||
|
|
||||||
@@ -209,6 +210,7 @@ namespace TEngine
|
|||||||
RegisterDebuggerWindow("Profiler/Memory/Font", _runtimeMemoryFontInformationWindow);
|
RegisterDebuggerWindow("Profiler/Memory/Font", _runtimeMemoryFontInformationWindow);
|
||||||
RegisterDebuggerWindow("Profiler/Memory/TextAsset", _runtimeMemoryTextAssetInformationWindow);
|
RegisterDebuggerWindow("Profiler/Memory/TextAsset", _runtimeMemoryTextAssetInformationWindow);
|
||||||
RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", _runtimeMemoryScriptableObjectInformationWindow);
|
RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", _runtimeMemoryScriptableObjectInformationWindow);
|
||||||
|
RegisterDebuggerWindow("Profiler/Object Pool", _objectPoolInformationWindow);;
|
||||||
RegisterDebuggerWindow("Profiler/Reference Pool", _memoryPoolPoolInformationWindow);
|
RegisterDebuggerWindow("Profiler/Reference Pool", _memoryPoolPoolInformationWindow);
|
||||||
RegisterDebuggerWindow("Other/Settings", _settingsWindow);
|
RegisterDebuggerWindow("Other/Settings", _settingsWindow);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user