mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-05-31 05:14:02 +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 RequestOpenNodeTouchFuntionData = { uuid: string; code: ShowCode; index: number };
|
||||
export type RequestOpenScriptData = {
|
||||
/**节点的UUID */
|
||||
/**节点或者组件的UUID */
|
||||
uuid: string;
|
||||
/**节点的脚本名字 */
|
||||
script: string;
|
||||
|
@ -125,21 +125,26 @@ export class Inspector extends InjectEvent {
|
||||
}
|
||||
case Msg.RequestOpenScript: {
|
||||
const data: RequestOpenScriptData = pluginEvent.data;
|
||||
const node = this.inspectorGameMemoryStorage[data.uuid];
|
||||
if (!node || !node.isValid) {
|
||||
const nodeOrComp = this.inspectorGameMemoryStorage[data.uuid];
|
||||
if (!nodeOrComp || !nodeOrComp.isValid) {
|
||||
return;
|
||||
}
|
||||
const comps = node._components;
|
||||
if (comps) {
|
||||
for (let i = 0; i < comps.length; i++) {
|
||||
const comp = comps[i];
|
||||
const compName = this.getCompName(comp);
|
||||
if (compName === data.script) {
|
||||
this.target = comp.constructor;
|
||||
break;
|
||||
if (nodeOrComp instanceof cc.Node) {
|
||||
const comps = nodeOrComp._components;
|
||||
if (comps) {
|
||||
for (let i = 0; i < comps.length; i++) {
|
||||
const comp = comps[i];
|
||||
const compName = this.getCompName(comp);
|
||||
if (compName === data.script) {
|
||||
this.target = comp.constructor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (true || nodeOrComp instanceof cc.Component) {
|
||||
this.target = nodeOrComp.constructor;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case Msg.RequestOpenNodeTouchFuntion: {
|
||||
|
@ -8,6 +8,7 @@
|
||||
</template>
|
||||
<template v-slot:header>
|
||||
<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>
|
||||
</template>
|
||||
<div style="padding-left: 6px">
|
||||
@ -20,7 +21,7 @@
|
||||
<script lang="ts">
|
||||
import ccui from "@xuyanfeng/cc-ui";
|
||||
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 { Bus, BusMsg } from "../bus";
|
||||
import { BoolData, Group, Info, Property } from "../data";
|
||||
@ -28,6 +29,7 @@ import UiProp from "./ui-prop.vue";
|
||||
import { VisibleProp } from "../comp";
|
||||
import { ga } from "../../../ga";
|
||||
import { GA_EventName } from "../../../ga/type";
|
||||
import { execInspect } from "../util";
|
||||
const { CCInput, CCSection, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor } = ccui.components;
|
||||
export default defineComponent({
|
||||
name: "property-group",
|
||||
@ -85,6 +87,11 @@ export default defineComponent({
|
||||
const data = [raw.group.id];
|
||||
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