This commit is contained in:
陈思海 2026-04-28 16:30:31 +08:00
parent 6a2e807fcc
commit 8cc5025796

View File

@ -56,12 +56,8 @@ namespace AlicizaX.Timer.Editor
return; return;
} }
if (timerService is not ITimerServiceDebug debugView)
{
return;
}
debugView.GetStatistics(out _cachedActiveCount, out _cachedPoolCapacity, out _cachedPeakActiveCount, out _cachedFreeCount); timerService.GetStatistics(out _cachedActiveCount, out _cachedPoolCapacity, out _cachedPeakActiveCount, out _cachedFreeCount);
_cachedUsageText = _cachedPoolCapacity > 0 _cachedUsageText = _cachedPoolCapacity > 0
? Utility.Text.Format("{0:F1}%", (float)_cachedActiveCount / _cachedPoolCapacity * 100f) ? Utility.Text.Format("{0:F1}%", (float)_cachedActiveCount / _cachedPoolCapacity * 100f)
: "0.0%"; : "0.0%";
@ -74,13 +70,13 @@ namespace AlicizaX.Timer.Editor
EditorGUILayout.LabelField("Free Slots", _cachedFreeCount.ToString()); EditorGUILayout.LabelField("Free Slots", _cachedFreeCount.ToString());
EditorGUILayout.LabelField("Pool Usage", _cachedUsageText); EditorGUILayout.LabelField("Pool Usage", _cachedUsageText);
DrawTimerList(debugView, _cachedActiveCount); DrawTimerList(timerService, _cachedActiveCount);
#if UNITY_EDITOR #if UNITY_EDITOR
DrawLeakDetection(debugView, _cachedActiveCount); DrawLeakDetection(timerService, _cachedActiveCount);
#endif #endif
} }
private void DrawTimerList(ITimerServiceDebug debug, int activeCount) private void DrawTimerList(ITimerService debug, int activeCount)
{ {
EditorGUILayout.Space(); EditorGUILayout.Space();
EditorGUILayout.LabelField("Active Timers", EditorStyles.boldLabel); EditorGUILayout.LabelField("Active Timers", EditorStyles.boldLabel);
@ -123,7 +119,7 @@ namespace AlicizaX.Timer.Editor
} }
#if UNITY_EDITOR #if UNITY_EDITOR
private void DrawLeakDetection(ITimerServiceDebug debug, int activeCount) private void DrawLeakDetection(ITimerService debug, int activeCount)
{ {
if (activeCount <= 0) if (activeCount <= 0)
{ {