From aba21c6f89debd008c815454074016870a749216 Mon Sep 17 00:00:00 2001 From: xu_yanfeng Date: Sun, 12 Jan 2025 11:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B3=A8=E5=85=A5=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=AE=9A=E6=97=B6=E5=88=B7=E6=96=B0=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96devtool-support=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=BC=95=E8=B5=B7=E7=95=8C=E9=9D=A2=E9=97=AA=E7=83=81?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cc-inspector/src/scripts/inject/inspector.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/cc-inspector/src/scripts/inject/inspector.ts b/cc-inspector/src/scripts/inject/inspector.ts index cb5c872..22210bf 100644 --- a/cc-inspector/src/scripts/inject/inspector.ts +++ b/cc-inspector/src/scripts/inject/inspector.ts @@ -11,18 +11,6 @@ declare const cc: any; export class Inspector extends InjectEvent { inspectorGameMemoryStorage: Record = {}; - private watchIsCocosGame() { - const timer = setInterval(() => { - if (this._isCocosGame()) { - clearInterval(timer); - // @ts-ignore - cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, () => { - const isCocosGame = this._isCocosGame(); - this.notifySupportGame(isCocosGame); - }); - } - }, 300); - } onMessage(pluginEvent: PluginEvent): void { switch (pluginEvent.msg) { case Msg.RequestSupport: { @@ -82,7 +70,6 @@ export class Inspector extends InjectEvent { } init() { console.log(...this.terminal.init()); - this.watchIsCocosGame(); } notifySupportGame(b: boolean) { @@ -99,8 +86,10 @@ export class Inspector extends InjectEvent { this.getNodeChildren(scene, treeData); this.sendMsgToContent(Msg.ResponseTreeInfo, treeData as ResponseTreeInfoData); } else { - console.warn("can't execute api : cc.director.getScene"); - this.notifySupportGame(false); + let treeData = new TreeData(); + treeData.id = ""; + treeData.text = "empty scene"; + this.sendMsgToContent(Msg.ResponseTreeInfo, treeData as ResponseTreeInfoData); } } else { this.notifySupportGame(false);