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() {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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-tree的渲染key
|
// el-tree的渲染key
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user