From bd0ac9b6a4b866c5c8c85186b4b7f3350bf96c28 Mon Sep 17 00:00:00 2001 From: xuyanfeng Date: Tue, 11 May 2021 21:26:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=AE=9E=E6=97=B6=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/src/devtools/index.vue | 10 +++++----- source/src/devtools/inject.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) 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)