mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-05-15 21:44:00 +00:00
节点如果挂的有用户脚本,会显示TS图标,并且鼠标长时间放上去后,会显示脚本的名字
This commit is contained in:
parent
ff10be89e3
commit
42f74e587d
@ -9,7 +9,7 @@ function i18n(key: string) {
|
||||
|
||||
const manifest: CocosPluginManifest = {
|
||||
name: pkgName,
|
||||
version: "2.1.14",
|
||||
version: "2.1.16",
|
||||
description: "Debug games made with CocosCreator and display node trees and node properties",
|
||||
store: "https://store.cocos.com/app/detail/2002",
|
||||
author: "xu_yanfeng",
|
||||
|
@ -348,6 +348,20 @@ export class Inspector extends InjectEvent {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
private getUserScripts(node: any): string[] {
|
||||
const ret: string[] = [];
|
||||
const comps = node._components;
|
||||
if (comps) {
|
||||
for (let i = 0; i < comps.length; i++) {
|
||||
const comp = comps[i];
|
||||
const compName = this.getCompName(comp);
|
||||
if (!compName.startsWith("cc")) {
|
||||
ret.push(compName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
// 收集节点信息
|
||||
getNodeChildren(node: any, data: TreeData) {
|
||||
data.id = node.uuid;
|
||||
@ -361,6 +375,11 @@ export class Inspector extends InjectEvent {
|
||||
// 场景不允许获取active,引擎会报错
|
||||
} else {
|
||||
data.active = !!node.active && !!node.activeInHierarchy;
|
||||
const scripts = this.getUserScripts(node);
|
||||
if (scripts.length) {
|
||||
data.subfixIcon = "icon_ts_text";
|
||||
data.subfixIconTip = scripts.join("\n");
|
||||
}
|
||||
}
|
||||
this.inspectorGameMemoryStorage[node.uuid] = node;
|
||||
let nodeChildren = node.children;
|
||||
|
@ -530,6 +530,8 @@ export class TreeData implements ITreeData {
|
||||
id: string = "";
|
||||
icon: string = "";
|
||||
color: string = "";
|
||||
subfixIcon?: string;
|
||||
subfixIconTip?: string;
|
||||
/**
|
||||
* 回调的数量
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user