mirror of
https://github.com/potato47/ccc-devtools.git
synced 2025-04-20 22:09:07 +00:00
1.解决cocosCreator2.4.2版本查看不了纹理缓存bug 2.使用cocos官方推荐的API
This commit is contained in:
parent
6bf3876262
commit
81dc179868
@ -117,11 +117,12 @@ const initConsoleUtil = function () {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
cc.cache = function () {
|
cc.cache = function () {
|
||||||
let rawCacheData = cc.loader._cache;
|
let rawCacheData = cc.assetManager.assets._map;
|
||||||
let cacheData = [];
|
let cacheData = [];
|
||||||
let totalTextureSize = 0;
|
let totalTextureSize = 0;
|
||||||
for (let k in rawCacheData) {
|
for (let k in rawCacheData) {
|
||||||
let item = rawCacheData[k];
|
let item = rawCacheData[k];
|
||||||
|
if(!item.content) item.content=item;
|
||||||
if (item.type !== 'js' && item.type !== 'json') {
|
if (item.type !== 'js' && item.type !== 'json') {
|
||||||
let itemName = '_';
|
let itemName = '_';
|
||||||
let preview = '';
|
let preview = '';
|
||||||
@ -131,7 +132,7 @@ const initConsoleUtil = function () {
|
|||||||
let texture = rawCacheData[k.replace('.' + item.type, '.json')];
|
let texture = rawCacheData[k.replace('.' + item.type, '.json')];
|
||||||
if (texture && texture._owner && texture._owner._name) {
|
if (texture && texture._owner && texture._owner._name) {
|
||||||
itemName = texture._owner._name;
|
itemName = texture._owner._name;
|
||||||
preview = texture.content.url;
|
preview = texture.content.nativeUrl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (item.content.name && item.content.name.length > 0) {
|
if (item.content.name && item.content.name.length > 0) {
|
||||||
@ -141,13 +142,13 @@ const initConsoleUtil = function () {
|
|||||||
}
|
}
|
||||||
if (content === 'cc.Texture2D') {
|
if (content === 'cc.Texture2D') {
|
||||||
let texture = item.content;
|
let texture = item.content;
|
||||||
preview = texture.url;
|
preview = texture.nativeUrl;
|
||||||
let textureSize = texture.width * texture.height * ((texture._native === '.jpg' ? 3 : 4) / 1024 / 1024);
|
let textureSize = texture.width * texture.height * ((texture._native === '.jpg' ? 3 : 4) / 1024 / 1024);
|
||||||
totalTextureSize += textureSize;
|
totalTextureSize += textureSize;
|
||||||
// sizeStr = textureSize.toFixed(3) + 'M';
|
// sizeStr = textureSize.toFixed(3) + 'M';
|
||||||
formatSize = Math.round(textureSize * 1000) / 1000;
|
formatSize = Math.round(textureSize * 1000) / 1000;
|
||||||
} else if (content === 'cc.SpriteFrame') {
|
} else if (content === 'cc.SpriteFrame') {
|
||||||
preview = item.content._texture.url;
|
preview = item.content._texture.nativeUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cacheData.push({
|
cacheData.push({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user