逻辑优化

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() { 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); this.getCurrentUseContent()?.postMessage(sendData);
} }

View File

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

View File

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