diff --git a/source/src/devtools/index.vue b/source/src/devtools/index.vue index 8b213e2..76eb54c 100644 --- a/source/src/devtools/index.vue +++ b/source/src/devtools/index.vue @@ -116,7 +116,7 @@ export default class Index extends Vue { if (data) { // 如果节点树为空,就刷新一次 if (this.treeData.length === 0) { - // this.onBtnClickUpdateTree(); + this.onBtnClickUpdateTree(); } } else { this._reset(); @@ -197,8 +197,6 @@ export default class Index extends Vue { handleNodeClick(data: TreeData) { this.selectedUUID = data.uuid; - // todo 去获取节点信息 - // console.log(data); let uuid = data.uuid; if (uuid !== undefined) { this.runToContentScript(Msg.NodeInfo, uuid); @@ -209,11 +207,13 @@ export default class Index extends Vue { if (this.watchEveryTime) { this.timerID = setInterval(() => { this.onBtnClickUpdateTree(); - }, 100); + if (this.selectedUUID) { + this.runToContentScript(Msg.NodeInfo, this.selectedUUID); + } + }, 300); } else { clearInterval(this.timerID); } - } runToContentScript(msg: Msg, data?: any) { diff --git a/source/src/devtools/inject.ts b/source/src/devtools/inject.ts index aa4a8be..2bccd09 100644 --- a/source/src/devtools/inject.ts +++ b/source/src/devtools/inject.ts @@ -19,13 +19,13 @@ class CCInspector { init() { console.log('cc-inspector init ~~~'); - // 注册cc_after_render事件 let timer = setInterval(() => { if (this._isCocosGame()) { clearInterval(timer) // @ts-ignore cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, () => { - console.log('scene launch') + let isCocosGame = this._isCocosGame(); + this.notifySupportGame(isCocosGame) }) } }, 300)