逻辑优化

This commit is contained in:
xyf-mac 2021-11-21 21:36:16 +08:00
parent 22cd02408d
commit 9e93dfbf16
4 changed files with 29 additions and 26 deletions

View File

@ -112,7 +112,7 @@ class PortMan {
}
private updateCurrentFrameTree() {
const sendData = new PluginEvent(Page.Background, Page.Content, Msg.TreeInfo);
const sendData = new PluginEvent(Page.Background, Page.Content, Msg.Support);
this.getCurrentUseContent()?.postMessage(sendData);
}

View File

@ -86,7 +86,6 @@ import {connectBackground} from "@/devtools/connectBackground";
import {
EngineData,
FrameDetails,
Group,
Info,
NodeInfoData,
ObjectData,
@ -133,9 +132,7 @@ export default class Index extends Vue {
this.showSettings = true;
}
private isShowRefreshBtn = false;
onCloseSettings() {
private syncSettings() {
if (settings.data) {
const {refreshType, refreshTime} = settings.data;
switch (refreshType) {
@ -152,6 +149,12 @@ export default class Index extends Vue {
}
}
private isShowRefreshBtn = false;
onCloseSettings() {
this.syncSettings();
}
// el-treekey
defaultProps = {
children: "children",
@ -249,10 +252,10 @@ export default class Index extends Vue {
}
this.treeData = treeData;
if (this._checkSelectedUUID()) {
this.updateNodeInfo();
this.$nextTick(() => {
//@ts-ignore
this.$refs.tree.setCurrentKey(this.selectedUUID);
// todo node
})
}
}
@ -296,25 +299,21 @@ export default class Index extends Vue {
this.memory = eventData;
}
_onMsgSupport(data: boolean) {
this.isShowDebug = data;
if (data) {
//
if (this.treeData.length === 0) {
_onMsgSupport(isCocosGame: boolean) {
this.isShowDebug = isCocosGame;
if (isCocosGame) {
this.syncSettings();
this.onBtnClickUpdateTree();
}
} else {
this._reset();
}
}
_reset() {
this._clearTimer();
this.treeData = [];
this.treeItemData = null;
this.selectedUUID = null;
}
}
mounted() {
this.onCloseSettings();
this.syncSettings();
}
_initChromeRuntimeConnect() {
@ -410,9 +409,12 @@ export default class Index extends Vue {
handleNodeClick(data: TreeData) {
this.selectedUUID = data.uuid;
let uuid = data.uuid;
if (uuid !== undefined) {
this.sendMsgToContentScript(Msg.NodeInfo, uuid);
this.updateNodeInfo();
}
private updateNodeInfo() {
if (this.selectedUUID) {
this.sendMsgToContentScript(Msg.NodeInfo, this.selectedUUID);
}
}

View File

@ -37,8 +37,8 @@ export default class PropertyGroup extends Vue {
group!: Group;
created() {
Bus.$on(BusMsg.FoldAllGroup, (b) => {
this.fold = !!b;
Bus.$on(BusMsg.FoldAllGroup, (b: boolean) => {
this.fold = b;
})
}

View File

@ -127,7 +127,8 @@ class CCInspector {
this.getNodeChildren(scene, treeData)
this.sendMsgToContent(Msg.TreeInfo, treeData);
} else {
this.sendMsgToContent(Msg.Support, {support: false, msg: "未发现游戏场景,不支持调试游戏!"});
console.warn("can't execute api : cc.director.getScene")
this.notifySupportGame(false);
}
} else {
this.notifySupportGame(false)