diff --git a/README.md b/README.md index e27da36..ad648da 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ccc-devtools v3.0.1 +# ccc-devtools Cocos Creator 网页调试工具,运行时查看、修改节点树,实时更新节点属性,可视化缓存资源。 ## 功能 diff --git a/libs/js/cc-console-utils.js b/libs/js/cc-console-utils.js index 6c10e9f..a29c4fa 100644 --- a/libs/js/cc-console-utils.js +++ b/libs/js/cc-console-utils.js @@ -117,7 +117,7 @@ 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) { @@ -125,7 +125,7 @@ const initConsoleUtil = function () { if (item.type !== 'js' && item.type !== 'json') { let itemName = '_'; let preview = ''; - let content = (item.content && item.content.__classname__) ? item.content.__classname__ : item.type; + let content = item.__classname__; let formatSize = -1; if (item.type === 'png' || item.type === 'jpg') { let texture = rawCacheData[k.replace('.' + item.type, '.json')]; @@ -134,29 +134,27 @@ const initConsoleUtil = function () { preview = texture.content.url; } } else { - if (item.content.name && item.content.name.length > 0) { - itemName = item.content.name; + if (item.name) { + itemName = item.name; } else if (item._owner) { itemName = (item._owner && item._owner.name) || '_'; } if (content === 'cc.Texture2D') { - let texture = item.content; - preview = texture.url; - let textureSize = texture.width * texture.height * ((texture._native === '.jpg' ? 3 : 4) / 1024 / 1024); + preview = item.nativeUrl; + let textureSize = item.width * item.height * ((item._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._texture.nativeUrl; } } cacheData.push({ queueId: item.queueId, - type: item.type, + type: content, name: itemName, preview: preview, - id: item.id, - content: content, + id: item._uuid, size: formatSize }); } diff --git a/preview.js b/preview.js index 418b993..dcbcc2c 100644 --- a/preview.js +++ b/preview.js @@ -13,7 +13,6 @@ const app = new Vue({ { text: 'Name', value: 'name' }, { text: 'Preivew', value: 'preview' }, { text: 'ID', value: 'id' }, - { text: 'Content', value: 'content' }, { text: 'Size', value: 'size' }, ], cacheRawData: [], @@ -143,7 +142,7 @@ const app = new Vue({ }, updateCacheData() { if (this.$data.cacheOnlyTexture) { - this.$data.cacheData = this.$data.cacheRawData.filter(item => item.content === 'cc.Texture2D'); + this.$data.cacheData = this.$data.cacheRawData.filter(item => item.type === 'cc.Texture2D'); } else { this.$data.cacheData = this.$data.cacheRawData; } diff --git a/version.json b/version.json index 737ba45..8a108cb 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "name": "ccc-devtools", - "version": "3.0.1", + "version": "2d-v2.4", "author": "Next", "repo": "https://github.com/potato47/ccc-devtools.git" } \ No newline at end of file