From 81dc1798686a6913f0edb462dc5dc89aa0a37c43 Mon Sep 17 00:00:00 2001 From: nimo Date: Wed, 12 Aug 2020 15:14:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3cocosCreator2.4.2=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=9F=A5=E7=9C=8B=E4=B8=8D=E4=BA=86=E7=BA=B9=E7=90=86?= =?UTF-8?q?=E7=BC=93=E5=AD=98bug=20=202.=E4=BD=BF=E7=94=A8cocos=E5=AE=98?= =?UTF-8?q?=E6=96=B9=E6=8E=A8=E8=8D=90=E7=9A=84API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/js/cc-console-utils.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/js/cc-console-utils.js b/libs/js/cc-console-utils.js index 6c10e9f..5341fa8 100644 --- a/libs/js/cc-console-utils.js +++ b/libs/js/cc-console-utils.js @@ -117,11 +117,12 @@ const initConsoleUtil = function () { return target; } cc.cache = function () { - let rawCacheData = cc.loader._cache; + let rawCacheData = cc.assetManager.assets._map; let cacheData = []; let totalTextureSize = 0; for (let k in rawCacheData) { let item = rawCacheData[k]; + if(!item.content) item.content=item; if (item.type !== 'js' && item.type !== 'json') { let itemName = '_'; let preview = ''; @@ -131,7 +132,7 @@ const initConsoleUtil = function () { let texture = rawCacheData[k.replace('.' + item.type, '.json')]; if (texture && texture._owner && texture._owner._name) { itemName = texture._owner._name; - preview = texture.content.url; + preview = texture.content.nativeUrl; } } else { if (item.content.name && item.content.name.length > 0) { @@ -141,13 +142,13 @@ const initConsoleUtil = function () { } if (content === 'cc.Texture2D') { let texture = item.content; - preview = texture.url; + preview = texture.nativeUrl; let textureSize = texture.width * texture.height * ((texture._native === '.jpg' ? 3 : 4) / 1024 / 1024); totalTextureSize += textureSize; // sizeStr = textureSize.toFixed(3) + 'M'; formatSize = Math.round(textureSize * 1000) / 1000; } else if (content === 'cc.SpriteFrame') { - preview = item.content._texture.url; + preview = item.content._texture.nativeUrl; } } cacheData.push({ @@ -164,4 +165,4 @@ const initConsoleUtil = function () { let cacheTitle = `缓存 [文件总数:${cacheData.length}][纹理缓存:${totalTextureSize.toFixed(2) + 'M'}]`; return [cacheData, cacheTitle]; } -} \ No newline at end of file +}