mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 11:18:30 +00:00
[engine] 修复高级性能指示器 Char Atlas 数据统计问题
This commit is contained in:
parent
3732877406
commit
070d510578
@ -82,24 +82,19 @@ function generateStats () {
|
|||||||
},
|
},
|
||||||
human() {
|
human() {
|
||||||
const atlases = cc.Label._shareAtlas.atlases;
|
const atlases = cc.Label._shareAtlas.atlases;
|
||||||
|
const chars = cc.Label._shareAtlas._fontDefDictionary._letterDefinitions;
|
||||||
|
const oneOfMax = atlases.reduce((a, b) => a + b._width * b._height, 0) / atlases.length;
|
||||||
let used = 0;
|
let used = 0;
|
||||||
let usedLess = 0;
|
let usedLess = 0;
|
||||||
for (const atlas of atlases) {
|
for (const key in chars) {
|
||||||
const max = atlas._width * atlas._height;
|
const char = chars[key];
|
||||||
let _used = atlas._width * atlas._nexty;
|
const size = char._height * char._width;
|
||||||
for (const area of atlas.frees) {
|
usedLess += size;
|
||||||
_used -= area._width * area._height;
|
if (char.ref > 0) {
|
||||||
|
used += size;
|
||||||
}
|
}
|
||||||
let _usedLess = _used;
|
|
||||||
for (const area of atlas.waitCleans) {
|
|
||||||
if (area.ref === 0) {
|
|
||||||
_usedLess -= area._width * area._height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
used += _used / max;
|
|
||||||
usedLess += _usedLess / max;
|
|
||||||
}
|
}
|
||||||
return `${(usedLess / atlases.length).toFixed(2)} / ${(used / atlases.length).toFixed(2)} / ${atlases.length}`;
|
return `${(used / oneOfMax).toFixed(2)} / ${(usedLess / oneOfMax).toFixed(2)} / ${atlases.length}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user