mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 08:58:41 +00:00
逻辑优化
This commit is contained in:
parent
22cd02408d
commit
9e93dfbf16
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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-tree的渲染key
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user