mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-19 16:38:41 +00:00
删除注入脚本定时刷新的逻辑,优化devtool-support消息引起界面闪烁的问题
This commit is contained in:
parent
8e85dbc304
commit
aba21c6f89
@ -11,18 +11,6 @@ declare const cc: any;
|
|||||||
export class Inspector extends InjectEvent {
|
export class Inspector extends InjectEvent {
|
||||||
inspectorGameMemoryStorage: Record<string, any> = {};
|
inspectorGameMemoryStorage: Record<string, any> = {};
|
||||||
|
|
||||||
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 {
|
onMessage(pluginEvent: PluginEvent): void {
|
||||||
switch (pluginEvent.msg) {
|
switch (pluginEvent.msg) {
|
||||||
case Msg.RequestSupport: {
|
case Msg.RequestSupport: {
|
||||||
@ -82,7 +70,6 @@ export class Inspector extends InjectEvent {
|
|||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
console.log(...this.terminal.init());
|
console.log(...this.terminal.init());
|
||||||
this.watchIsCocosGame();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notifySupportGame(b: boolean) {
|
notifySupportGame(b: boolean) {
|
||||||
@ -99,8 +86,10 @@ export class Inspector extends InjectEvent {
|
|||||||
this.getNodeChildren(scene, treeData);
|
this.getNodeChildren(scene, treeData);
|
||||||
this.sendMsgToContent(Msg.ResponseTreeInfo, treeData as ResponseTreeInfoData);
|
this.sendMsgToContent(Msg.ResponseTreeInfo, treeData as ResponseTreeInfoData);
|
||||||
} else {
|
} else {
|
||||||
console.warn("can't execute api : cc.director.getScene");
|
let treeData = new TreeData();
|
||||||
this.notifySupportGame(false);
|
treeData.id = "";
|
||||||
|
treeData.text = "empty scene";
|
||||||
|
this.sendMsgToContent(Msg.ResponseTreeInfo, treeData as ResponseTreeInfoData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.notifySupportGame(false);
|
this.notifySupportGame(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user