mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-06-01 13:54:05 +00:00
属性面板增加跳转Source的功能
Some checks failed
Deploy static content to Pages / deploy (push) Has been cancelled
Some checks failed
Deploy static content to Pages / deploy (push) Has been cancelled
This commit is contained in:
parent
c739a89802
commit
78b50a72b0
@ -75,7 +75,7 @@ export type ResponseSetPropertyData = Info;
|
|||||||
export type RequestLogData = string[];
|
export type RequestLogData = string[];
|
||||||
export type RequestOpenNodeTouchFuntionData = { uuid: string; code: ShowCode; index: number };
|
export type RequestOpenNodeTouchFuntionData = { uuid: string; code: ShowCode; index: number };
|
||||||
export type RequestOpenScriptData = {
|
export type RequestOpenScriptData = {
|
||||||
/**节点的UUID */
|
/**节点或者组件的UUID */
|
||||||
uuid: string;
|
uuid: string;
|
||||||
/**节点的脚本名字 */
|
/**节点的脚本名字 */
|
||||||
script: string;
|
script: string;
|
||||||
|
@ -125,21 +125,26 @@ export class Inspector extends InjectEvent {
|
|||||||
}
|
}
|
||||||
case Msg.RequestOpenScript: {
|
case Msg.RequestOpenScript: {
|
||||||
const data: RequestOpenScriptData = pluginEvent.data;
|
const data: RequestOpenScriptData = pluginEvent.data;
|
||||||
const node = this.inspectorGameMemoryStorage[data.uuid];
|
const nodeOrComp = this.inspectorGameMemoryStorage[data.uuid];
|
||||||
if (!node || !node.isValid) {
|
if (!nodeOrComp || !nodeOrComp.isValid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const comps = node._components;
|
if (nodeOrComp instanceof cc.Node) {
|
||||||
if (comps) {
|
const comps = nodeOrComp._components;
|
||||||
for (let i = 0; i < comps.length; i++) {
|
if (comps) {
|
||||||
const comp = comps[i];
|
for (let i = 0; i < comps.length; i++) {
|
||||||
const compName = this.getCompName(comp);
|
const comp = comps[i];
|
||||||
if (compName === data.script) {
|
const compName = this.getCompName(comp);
|
||||||
this.target = comp.constructor;
|
if (compName === data.script) {
|
||||||
break;
|
this.target = comp.constructor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (true || nodeOrComp instanceof cc.Component) {
|
||||||
|
this.target = nodeOrComp.constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Msg.RequestOpenNodeTouchFuntion: {
|
case Msg.RequestOpenNodeTouchFuntion: {
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<div style="flex: 1"></div>
|
<div style="flex: 1"></div>
|
||||||
|
<i v-if="!['cc.Node', 'cc.Scene'].find((el) => el === group.name)" @click.stop="onOpenCode" class="print iconfont icon_ts_text" title="在Source面板中打开对应的源代码"></i>
|
||||||
<i style="" @click.stop="onLog" class="print iconfont icon_print" title="值会临时保存到window.temp"></i>
|
<i style="" @click.stop="onLog" class="print iconfont icon_print" title="值会临时保存到window.temp"></i>
|
||||||
</template>
|
</template>
|
||||||
<div style="padding-left: 6px">
|
<div style="padding-left: 6px">
|
||||||
@ -20,7 +21,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ccui from "@xuyanfeng/cc-ui";
|
import ccui from "@xuyanfeng/cc-ui";
|
||||||
import { defineComponent, onMounted, onUnmounted, PropType, ref, toRaw, watch } from "vue";
|
import { defineComponent, onMounted, onUnmounted, PropType, ref, toRaw, watch } from "vue";
|
||||||
import { Msg, RequestLogData, RequestSetPropertyData } from "../../../core/types";
|
import { Msg, RequestLogData, RequestOpenScriptData, RequestSetPropertyData } from "../../../core/types";
|
||||||
import { bridge } from "../bridge";
|
import { bridge } from "../bridge";
|
||||||
import { Bus, BusMsg } from "../bus";
|
import { Bus, BusMsg } from "../bus";
|
||||||
import { BoolData, Group, Info, Property } from "../data";
|
import { BoolData, Group, Info, Property } from "../data";
|
||||||
@ -28,6 +29,7 @@ import UiProp from "./ui-prop.vue";
|
|||||||
import { VisibleProp } from "../comp";
|
import { VisibleProp } from "../comp";
|
||||||
import { ga } from "../../../ga";
|
import { ga } from "../../../ga";
|
||||||
import { GA_EventName } from "../../../ga/type";
|
import { GA_EventName } from "../../../ga/type";
|
||||||
|
import { execInspect } from "../util";
|
||||||
const { CCInput, CCSection, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor } = ccui.components;
|
const { CCInput, CCSection, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor } = ccui.components;
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "property-group",
|
name: "property-group",
|
||||||
@ -85,6 +87,11 @@ export default defineComponent({
|
|||||||
const data = [raw.group.id];
|
const data = [raw.group.id];
|
||||||
bridge.send(Msg.RequestLogData, data as RequestLogData);
|
bridge.send(Msg.RequestLogData, data as RequestLogData);
|
||||||
},
|
},
|
||||||
|
onOpenCode() {
|
||||||
|
const raw = toRaw(props.group);
|
||||||
|
bridge.send(Msg.RequestOpenScript, { uuid: raw.id, script: raw.name } as RequestOpenScriptData);
|
||||||
|
execInspect();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user