完成实时监控的逻辑

This commit is contained in:
xuyanfeng 2021-05-11 21:26:36 +08:00
parent e5e38d92b9
commit bd0ac9b6a4
2 changed files with 7 additions and 7 deletions

View File

@ -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) {

View File

@ -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)