mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-10-09 14:45:25 +00:00
节点如果挂的有用户脚本,会显示TS图标,并且鼠标长时间放上去后,会显示脚本的名字
This commit is contained in:
@@ -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;
|
||||
/**
|
||||
* 回调的数量
|
||||
*/
|
||||
|
Reference in New Issue
Block a user