From 2faa6c31fd3fe9df4d38c815b1d44dc10b2e3c06 Mon Sep 17 00:00:00 2001 From: SmallMain Date: Fri, 13 Dec 2024 17:00:16 +0800 Subject: [PATCH] =?UTF-8?q?[engine]=20=E9=AB=98=E7=BA=A7=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E6=8C=87=E7=A4=BA=E5=99=A8=E5=85=BC=E5=AE=B9=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=80=81=E5=90=88=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cocos2d/core/utils/profiler/CCProfiler.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/engine/cocos2d/core/utils/profiler/CCProfiler.js b/engine/cocos2d/core/utils/profiler/CCProfiler.js index f40f273f..53311eb0 100644 --- a/engine/cocos2d/core/utils/profiler/CCProfiler.js +++ b/engine/cocos2d/core/utils/profiler/CCProfiler.js @@ -113,16 +113,19 @@ function generateStats () { }, human() { - const atlases = cc.dynamicAtlasManager.atlases; - const max = cc.dynamicAtlasManager.maxAtlasCount; - const curLess = cc.dynamicAtlasManager.atlasCount; - const oneOfMax = cc.dynamicAtlasManager.textureSize * cc.dynamicAtlasManager.textureSize; - let cur = 0; - for (const key in cc.dynamicAtlasManager.rects) { - const rect = cc.dynamicAtlasManager.rects[key]; - cur += rect.sizes; + if (cc.dynamicAtlasManager && cc.dynamicAtlasManager.enabled) { + const max = cc.dynamicAtlasManager.maxAtlasCount; + const curLess = cc.dynamicAtlasManager.atlasCount; + const oneOfMax = cc.dynamicAtlasManager.textureSize * cc.dynamicAtlasManager.textureSize; + let cur = 0; + for (const key in cc.dynamicAtlasManager.rects) { + const rect = cc.dynamicAtlasManager.rects[key]; + cur += rect.sizes; + } + return `${(cur / oneOfMax).toFixed(2)} / ${curLess} / ${max}`; + } else { + return 'disabled'; } - return `${(cur / oneOfMax).toFixed(2)} / ${curLess} / ${max}`; } }, };