mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-19 08:28:41 +00:00
增加log功能
This commit is contained in:
parent
67dea61ffe
commit
8702f666d0
@ -44,6 +44,7 @@ module.exports = {
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"no-inner-declarations": "off",
|
||||
"vue/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-namespace": "off"
|
||||
"@typescript-eslint/no-namespace": "off",
|
||||
"@typescript-eslint/no-this-alias": "off"
|
||||
}
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ export enum Msg {
|
||||
UpdateFrames = "UpdateFrames", // 更新页面的frame
|
||||
UseFrame = "UseFrame",
|
||||
GetObjectItemData = "GetObjectItemData",
|
||||
LogData = "LogData",
|
||||
SetProperty = "set-property", // 设置node属性
|
||||
UpdateProperty = "update-property", // 更新属性
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import Vue from "vue"
|
||||
export enum BusMsg {
|
||||
ShowPlace = "ShowPlace",
|
||||
RequestObjectData = "RequestObjectData",
|
||||
LogData = "LogData",
|
||||
FoldAllGroup = "FoldAllGroup"
|
||||
}
|
||||
|
||||
|
@ -193,11 +193,13 @@ export class Property {
|
||||
}
|
||||
|
||||
export class Group {
|
||||
public id: string = "";
|
||||
public name: string = "group";
|
||||
public data: Array<Property> = [];
|
||||
|
||||
constructor(name: string) {
|
||||
constructor(name: string,id?:string) {
|
||||
this.name = name;
|
||||
this.id=id||'';
|
||||
}
|
||||
|
||||
addProperty(property: Property) {
|
||||
|
@ -147,7 +147,6 @@ export default class Index extends Vue {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private syncSettings() {
|
||||
if (settings.data) {
|
||||
const {refreshType, refreshTime} = settings.data;
|
||||
@ -204,6 +203,9 @@ export default class Index extends Vue {
|
||||
this.requestList.push({id: data.id, cb});
|
||||
this.sendMsgToContentScript(Msg.GetObjectItemData, data)
|
||||
});
|
||||
Bus.$on(BusMsg.LogData, (data: string[]) => {
|
||||
this.sendMsgToContentScript(Msg.LogData, data);
|
||||
})
|
||||
}
|
||||
|
||||
filterNode(value: any, data: any) {
|
||||
|
@ -1,12 +1,20 @@
|
||||
<template>
|
||||
<div class="property-group">
|
||||
<div class="header" @click="onClickHeader">
|
||||
<div class="header" @click="onClickHeader"
|
||||
@mouseenter="showLogBtn=true"
|
||||
@mouseleave="showLogBtn=false">
|
||||
<div style="margin: 0 5px;">
|
||||
<i v-if="fold" class="el-icon-caret-right"></i>
|
||||
<i v-if="!fold" class="el-icon-caret-bottom"></i>
|
||||
</div>
|
||||
<div style="flex:1;">
|
||||
{{ group.name }}
|
||||
</div>
|
||||
<el-button style="margin-right: 10px;"
|
||||
v-show="showLogBtn"
|
||||
type="success" icon="el-icon-chat-dot-round" @click.stop="onLog">
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="content" v-show="!fold">
|
||||
<ui-prop v-for="(item, index) in group.data" :key="index"
|
||||
:name="item.name" :value="item.value">
|
||||
@ -29,6 +37,7 @@ import Bus, {BusMsg} from "@/devtools/bus";
|
||||
})
|
||||
export default class PropertyGroup extends Vue {
|
||||
private fold = false;
|
||||
private showLogBtn = false;
|
||||
@Prop({
|
||||
default: () => {
|
||||
return new Group("test")
|
||||
@ -45,6 +54,10 @@ export default class PropertyGroup extends Vue {
|
||||
mounted() {
|
||||
}
|
||||
|
||||
onLog() {
|
||||
Bus.$emit(BusMsg.LogData, [this.group.id]);
|
||||
}
|
||||
|
||||
onClickHeader() {
|
||||
this.fold = !this.fold;
|
||||
}
|
||||
|
@ -85,6 +85,12 @@ class CCInspector {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Msg.LogData: {
|
||||
const data: string[] = pluginEvent.data;
|
||||
const value = getValue(this.inspectorGameMemoryStorage, data);
|
||||
console.log(value);
|
||||
break;
|
||||
}
|
||||
case Msg.GetObjectItemData: {
|
||||
const data: ObjectData = pluginEvent.data;
|
||||
let val = getValue(this.inspectorGameMemoryStorage, data.path);
|
||||
@ -526,7 +532,7 @@ class CCInspector {
|
||||
|
||||
_getGroupData(node: any) {
|
||||
const name = this.getCompName(node);
|
||||
let nodeGroup = new Group(name);
|
||||
let nodeGroup = new Group(name, node.uuid);
|
||||
let keys = this._getNodeKeys(node);
|
||||
for (let i = 0; i < keys.length;) {
|
||||
let key = keys[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user