格式化代码

This commit is contained in:
xu_yanfeng 2024-12-27 14:23:27 +08:00
parent ae59ee5a10
commit f7937a5c8b
23 changed files with 215 additions and 210 deletions

View File

@ -1,10 +1,5 @@
// @ts-ignore // @ts-ignore
import { import { CocosPluginManifest, CocosPluginOptions, Panel } from "cc-plugin/src/declare";
CocosPluginManifest,
CocosPluginOptions,
Panel,
PluginType,
} from "cc-plugin/src/declare";
const pkgName = "cc-inspector"; const pkgName = "cc-inspector";

View File

@ -1,19 +1,17 @@
import CCP from 'cc-plugin/src/ccp/entry-main'; import CCP from "cc-plugin/src/ccp/entry-main";
import { BuilderOptions } from 'cc-plugin/src/declare'; import { BuilderOptions } from "cc-plugin/src/declare";
import pluginConfig from '../cc-plugin.config'; import pluginConfig from "../cc-plugin.config";
CCP.init(pluginConfig, { CCP.init(pluginConfig, {
load: () => { load: () => {
console.log('plugin load') console.log("plugin load");
}, },
builder: { builder: {
onAfterBuild(target: BuilderOptions) { onAfterBuild(target: BuilderOptions) {},
}
}, },
messages: { messages: {
showPanel() { showPanel() {
CCP.Adaptation.Panel.open('self.main') CCP.Adaptation.Panel.open("self.main");
} },
} },
}) });

View File

@ -1,9 +1,8 @@
import { ChromeConst } from "cc-plugin/src/chrome/const"; import { ChromeConst } from "cc-plugin/src/chrome/const";
import { Msg, Page, PluginEvent } from "../../core/types"; import { Msg, Page, PluginEvent } from "../../core/types";
import { FrameDetails } from "../../views/devtools/data";
import { PortMan } from "./portMan";
import { PortMgr, portMgr } from "./portMgr";
import { Terminal } from "../terminal"; import { Terminal } from "../terminal";
import { PortMan } from "./portMan";
import { portMgr } from "./portMgr";
const terminal = new Terminal(Page.Background); const terminal = new Terminal(Page.Background);
console.log(...terminal.init()); console.log(...terminal.init());
function isDevtools(port: chrome.runtime.Port) { function isDevtools(port: chrome.runtime.Port) {
@ -16,7 +15,7 @@ function onTabConnect(tab: chrome.tabs.Tab, port: chrome.runtime.Port) {
debugger; debugger;
return; return;
} }
let portMan = portMgr.findPort(tab.id) let portMan = portMgr.findPort(tab.id);
if (portMan) { if (portMan) {
// 一个port发起多次发起链接以最后一次的为数据通讯基准 // 一个port发起多次发起链接以最后一次的为数据通讯基准
// portMgr.removePort(portMan); // portMgr.removePort(portMan);
@ -30,7 +29,7 @@ chrome.runtime.onConnect.addListener((port: chrome.runtime.Port) => {
chrome.tabs.query({ active: true }, (tabs: chrome.tabs.Tab[]) => { chrome.tabs.query({ active: true }, (tabs: chrome.tabs.Tab[]) => {
tabs.forEach((tab) => { tabs.forEach((tab) => {
onTabConnect(tab, port); onTabConnect(tab, port);
}) });
}); });
} else { } else {
const tab: chrome.tabs.Tab | undefined = port.sender?.tab; const tab: chrome.tabs.Tab | undefined = port.sender?.tab;
@ -52,7 +51,7 @@ chrome.runtime.onMessage.addListener((request: PluginEvent, sender: any, sendRes
} }
} }
}); });
chrome.tabs.onActivated.addListener(({ tabId, windowId }) => { }); chrome.tabs.onActivated.addListener(({ tabId, windowId }) => {});
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
// 页面发生刷新,通知重新生成数据 // 页面发生刷新,通知重新生成数据
if (changeInfo.status === "complete") { if (changeInfo.status === "complete") {

View File

@ -1,7 +1,6 @@
import { Msg, Page, PluginEvent } from "../../core/types"; import { PluginEvent } from "../../core/types";
import { PortMan } from "./portMan"; import { PortMan } from "./portMan";
import { portMgr } from "./portMgr"; import { portMgr } from "./portMgr";
import { FrameDetails } from "views/devtools/data";
export class PortContent extends PortMan { export class PortContent extends PortMan {
init(): void { init(): void {

View File

@ -8,7 +8,7 @@ export class PortDevtools extends PortMan {
portMgr._updateFrames(); portMgr._updateFrames();
this.onDisconnect = () => { this.onDisconnect = () => {
portMgr.removePort(this); portMgr.removePort(this);
} };
this.onMessage = (data: PluginEvent) => { this.onMessage = (data: PluginEvent) => {
if (data.msg === Msg.UseFrame) { if (data.msg === Msg.UseFrame) {
portMgr.useFrame(data.data); portMgr.useFrame(data.data);
@ -29,8 +29,6 @@ export class PortDevtools extends PortMan {
port.postMessage(data); port.postMessage(data);
} }
} }
};
}
} }
} }

View File

@ -1,8 +1,5 @@
import { ChromeConst } from "cc-plugin/src/chrome/const"; import { Page, PluginEvent } from "../../core/types";
import { Msg, Page, PluginEvent } from "../../core/types";
import { FrameDetails } from "../../views/devtools/data";
import { Terminal } from "../terminal"; import { Terminal } from "../terminal";
import { portMgr } from "./portMgr";
export abstract class PortMan { export abstract class PortMan {
/** /**
@ -32,13 +29,13 @@ export abstract class PortMan {
this.terminal = new Terminal(`Port-${this.name}`); this.terminal = new Terminal(`Port-${this.name}`);
port.onMessage.addListener((data: any, port: chrome.runtime.Port) => { port.onMessage.addListener((data: any, port: chrome.runtime.Port) => {
const event = PluginEvent.create(data); const event = PluginEvent.create(data);
console.log(... this.terminal.chunkMessage(event.toChunk())); console.log(...this.terminal.chunkMessage(event.toChunk()));
// 如果多个页面都监听 onMessage 事件,对于某一次事件只有第一次调用 sendResponse() 能成功发出回应,所有其他回应将被忽略。 // 如果多个页面都监听 onMessage 事件,对于某一次事件只有第一次调用 sendResponse() 能成功发出回应,所有其他回应将被忽略。
// port.postMessage(data); // port.postMessage(data);
if (event.valid && this.onMessage) { if (event.valid && this.onMessage) {
this.onMessage(event); this.onMessage(event);
} else { } else {
console.log(... this.terminal.log(JSON.stringify(data))); console.log(...this.terminal.log(JSON.stringify(data)));
} }
}); });
port.onDisconnect.addListener((port: chrome.runtime.Port) => { port.onDisconnect.addListener((port: chrome.runtime.Port) => {

View File

@ -1,9 +1,9 @@
import { Msg, Page, PluginEvent } from "../../core/types";
import { PortMan } from "./portMan";
import { PortDevtools } from "./portDevtools";
import { PortContent } from "./portContent";
import { FrameDetails } from "views/devtools/data"; import { FrameDetails } from "views/devtools/data";
import { Msg, Page, PluginEvent } from "../../core/types";
import { Terminal } from "../terminal"; import { Terminal } from "../terminal";
import { PortContent } from "./portContent";
import { PortDevtools } from "./portDevtools";
import { PortMan } from "./portMan";
export class PortMgr { export class PortMgr {
/** /**
@ -15,7 +15,7 @@ export class PortMgr {
* frameIDiframe嵌套 * frameIDiframe嵌套
*/ */
private currentUseContentFrameID = 0; private currentUseContentFrameID = 0;
private terminal = new Terminal('PortMgr'); private terminal = new Terminal("PortMgr");
public findDevtoolsPort() { public findDevtoolsPort() {
return this.portArray.find((el) => el.name === Page.Devtools); return this.portArray.find((el) => el.name === Page.Devtools);
} }
@ -25,14 +25,14 @@ export class PortMgr {
public _updateFrames() { public _updateFrames() {
// 将content类型的port收集起来同步到devtools // 将content类型的port收集起来同步到devtools
const data: FrameDetails[] = []; const data: FrameDetails[] = [];
this.portArray.forEach(item => { this.portArray.forEach((item) => {
if (item.isConnectPort()) { if (item.isConnectPort()) {
data.push({ data.push({
url: item.port.sender?.url || "", url: item.port.sender?.url || "",
frameID: item.port.sender?.frameId || 0, frameID: item.port.sender?.frameId || 0,
}) });
} }
}) });
const event = new PluginEvent(Page.Background, Page.Devtools, Msg.UpdateFrames, data); const event = new PluginEvent(Page.Background, Page.Devtools, Msg.UpdateFrames, data);
this.sendDevtoolMsg(event); this.sendDevtoolMsg(event);
} }
@ -49,7 +49,7 @@ export class PortMgr {
break; break;
} }
default: { default: {
debugger debugger;
break; break;
} }
} }
@ -61,23 +61,23 @@ export class PortMgr {
return null; return null;
} }
public logState() { public logState() {
let arr: Array<{ name: string, id: number, url: string }> = []; let arr: Array<{ name: string; id: number; url: string }> = [];
let str: string[] = []; let str: string[] = [];
for (let i = 0; i < this.portArray.length; i++) { for (let i = 0; i < this.portArray.length; i++) {
const port = this.portArray[i]; const port = this.portArray[i];
arr.push({ arr.push({
name: port.name, name: port.name,
id: port.id, id: port.id,
url: port.url url: port.url,
}); });
str.push(`[${i + 1}] time:${new Date(port.timestamp).toLocaleString()}, name:${port.name}, id:${port.id}, url:${port.url}`); str.push(`[${i + 1}] time:${new Date(port.timestamp).toLocaleString()}, name:${port.name}, id:${port.id}, url:${port.url}`);
} }
if (arr.length) { if (arr.length) {
// console.table(arr) // console.table(arr)
console.log(... this.terminal.log(str.join('\n'), true)); console.log(...this.terminal.log(str.join("\n"), true));
} else { } else {
console.log(... this.terminal.log("no port connected")); console.log(...this.terminal.log("no port connected"));
} }
} }
public removePort(item: PortMan) { public removePort(item: PortMan) {
@ -92,22 +92,22 @@ export class PortMgr {
this.getCurrentUseContent()?.postMessage(data); this.getCurrentUseContent()?.postMessage(data);
} }
sendDevtoolMsg(data: PluginEvent) { sendDevtoolMsg(data: PluginEvent) {
const portManArray = this.portArray.filter(el => el.isDevtoolsPort()); const portManArray = this.portArray.filter((el) => el.isDevtoolsPort());
if (portManArray.length) { if (portManArray.length) {
portManArray.forEach(portMan => { portManArray.forEach((portMan) => {
portMan.port.postMessage(data); portMan.port.postMessage(data);
}) });
} else { } else {
console.log('not find devtools port'); console.log("not find devtools port");
} }
} }
getCurrentUseContent(): chrome.runtime.Port | null { getCurrentUseContent(): chrome.runtime.Port | null {
const portMan = this.portArray.find((portMan: PortMan) => { const portMan = this.portArray.find((portMan: PortMan) => {
const el = portMan.port; const el = portMan.port;
const b1 = el.sender?.frameId !== undefined; const b1 = el.sender?.frameId !== undefined;
const b2 = el.sender.frameId === this.currentUseContentFrameID const b2 = el.sender.frameId === this.currentUseContentFrameID;
return b1 && b2 return b1 && b2;
}) });
if (portMan) { if (portMan) {
return portMan.port; return portMan.port;
} else { } else {
@ -121,7 +121,7 @@ export class PortMgr {
this.getCurrentUseContent()?.postMessage(sendData); this.getCurrentUseContent()?.postMessage(sendData);
} }
isCurrentFrme(id: number) { isCurrentFrme(id: number) {
return this.currentUseContentFrameID === id return this.currentUseContentFrameID === id;
} }
} }
export const portMgr = new PortMgr(); export const portMgr = new PortMgr();

View File

@ -1,10 +1,10 @@
import CCP from "cc-plugin/src/ccp/entry-render"; import CCP from "cc-plugin/src/ccp/entry-render";
import { Msg, Page, PluginEvent } from "../../core/types"; import { Msg, Page, PluginEvent } from "../../core/types";
import { TestClient, testServer, TestServer } from "./test/server";
import { Terminal } from "../../scripts/terminal"; import { Terminal } from "../../scripts/terminal";
import { TestClient, testServer } from "./test/server";
export type BridgeCallback = (data: PluginEvent, sender: chrome.runtime.Port) => void; export type BridgeCallback = (data: PluginEvent, sender: chrome.runtime.Port) => void;
if (chrome.devtools) { if (chrome.devtools) {
console.log("chrome devtools") console.log("chrome devtools");
} }
class Bridge implements TestClient { class Bridge implements TestClient {
/** /**
@ -25,9 +25,9 @@ class Bridge implements TestClient {
if (CCP.Adaptation.Env.isChromeRuntime) { if (CCP.Adaptation.Env.isChromeRuntime) {
this.connect = chrome.runtime.connect({ name: Page.Devtools }); this.connect = chrome.runtime.connect({ name: Page.Devtools });
this.connect.onDisconnect.addListener(() => { this.connect.onDisconnect.addListener(() => {
console.log(...this.terminal.disconnect("")) console.log(...this.terminal.disconnect(""));
this.connect = null; this.connect = null;
}) });
this.connect.onMessage.addListener((event, sender: chrome.runtime.Port) => { this.connect.onMessage.addListener((event, sender: chrome.runtime.Port) => {
const data = PluginEvent.create(event); const data = PluginEvent.create(event);
@ -38,7 +38,6 @@ class Bridge implements TestClient {
console.log(JSON.stringify(event)); console.log(JSON.stringify(event));
} }
}); });
} else { } else {
testServer.add(this); testServer.add(this);
} }
@ -55,12 +54,12 @@ class Bridge implements TestClient {
send(msg: Msg, data?: any) { send(msg: Msg, data?: any) {
if (CCP.Adaptation.Env.isChromeDevtools) { if (CCP.Adaptation.Env.isChromeDevtools) {
if (this.connect) { if (this.connect) {
let sendData = new PluginEvent(Page.Devtools, Page.Background, msg, data) let sendData = new PluginEvent(Page.Devtools, Page.Background, msg, data);
this.connect.postMessage(sendData) this.connect.postMessage(sendData);
} else { } else {
console.warn(...this.terminal.log("重新和background建立链接")) console.warn(...this.terminal.log("重新和background建立链接"));
this.init(); this.init();
this.send(msg, data) this.send(msg, data);
} }
} else { } else {
testServer.recv(msg, data); testServer.recv(msg, data);

View File

@ -1,4 +1,4 @@
import { TinyEmitter } from 'tiny-emitter'; import { TinyEmitter } from "tiny-emitter";
export enum BusMsg { export enum BusMsg {
ShowPlace = "ShowPlace", ShowPlace = "ShowPlace",

View File

@ -1,4 +1,3 @@
function createPluginMenus() { function createPluginMenus() {
const menus = []; const menus = [];

View File

@ -1,21 +1,21 @@
import { ITreeData } from '@xuyanfeng/cc-ui/types/cc-tree/const'; import { ITreeData } from "@xuyanfeng/cc-ui/types/cc-tree/const";
import { v4 } from "uuid"; import { v4 } from "uuid";
export enum DataType { export enum DataType {
Number = 'Number', Number = "Number",
String = 'String', String = "String",
Text = 'Text', Text = "Text",
Vec2 = 'Vec2', Vec2 = "Vec2",
Vec3 = 'Vec3', Vec3 = "Vec3",
Vec4 = 'Vec4', Vec4 = "Vec4",
Enum = 'Enum', Enum = "Enum",
Bool = 'Bool', Bool = "Bool",
Color = 'Color', Color = "Color",
Invalid = 'Invalid', Invalid = "Invalid",
Array = 'Array', // 暂时在控制台打印下 Array = "Array", // 暂时在控制台打印下
Object = 'Object', Object = "Object",
ObjectItem = 'ObjectItem', ObjectItem = "ObjectItem",
Image = 'Image', // 图片 Image = "Image", // 图片
Engine = 'Engine',// 引擎的类型cc.Node, cc.Sprite, cc.Label等。。。 Engine = "Engine", // 引擎的类型cc.Node, cc.Sprite, cc.Label等。。。
} }
export class Info { export class Info {
@ -23,7 +23,7 @@ export class Info {
public type: DataType = DataType.Number; public type: DataType = DataType.Number;
public data: any; public data: any;
public readonly: boolean = false; public readonly: boolean = false;
public path: Array<string> = [];// 属性对应的路径 public path: Array<string> = []; // 属性对应的路径
constructor(id: string = "") { constructor(id: string = "") {
this.id = id || v4(); this.id = id || v4();
} }
@ -32,21 +32,51 @@ export class Info {
this.path = data.path; this.path = data.path;
this.readonly = data.readonly; this.readonly = data.readonly;
} }
public isEnum(): boolean { return false; } public isEnum(): boolean {
public isVec2(): boolean { return false; } return false;
public isVec3(): boolean { return false; } }
public isVec4(): boolean { return false; } public isVec2(): boolean {
public isBool(): boolean { return false; } return false;
public isText(): boolean { return false; } }
public isString(): boolean { return false; } public isVec3(): boolean {
public isColor(): boolean { return false; } return false;
public isInvalid(): boolean { return false; } }
public isNumber(): boolean { return false; } public isVec4(): boolean {
public isArrayOrObject(): boolean { return false; } return false;
public isArray(): boolean { return false; } }
public isObject(): boolean { return false; } public isBool(): boolean {
public isImage(): boolean { return false; } return false;
public isEngine(): boolean { return false; } }
public isText(): boolean {
return false;
}
public isString(): boolean {
return false;
}
public isColor(): boolean {
return false;
}
public isInvalid(): boolean {
return false;
}
public isNumber(): boolean {
return false;
}
public isArrayOrObject(): boolean {
return false;
}
public isArray(): boolean {
return false;
}
public isObject(): boolean {
return false;
}
public isImage(): boolean {
return false;
}
public isEngine(): boolean {
return false;
}
} }
export class TextData extends Info { export class TextData extends Info {
@ -61,7 +91,9 @@ export class TextData extends Info {
this.data = data.data; this.data = data.data;
return this; return this;
} }
public isText(): boolean { return true; } public isText(): boolean {
return true;
}
} }
export interface ObjectItemRequestData { export interface ObjectItemRequestData {
@ -102,7 +134,9 @@ export class EngineData extends Info {
this.engineUUID = uuid; this.engineUUID = uuid;
return this; return this;
} }
public isEngine(): boolean { return true; } public isEngine(): boolean {
return true;
}
} }
export class ArrayData extends Info { export class ArrayData extends Info {
@ -135,16 +169,18 @@ export class ArrayData extends Info {
this.add(new Property("item1", new TextData("text"))); this.add(new Property("item1", new TextData("text")));
const sub = new ArrayData(); const sub = new ArrayData();
sub.add(new Property("sub", new StringData("sub"))); sub.add(new Property("sub", new StringData("sub")));
this.add(new Property('arr', sub)); this.add(new Property("arr", sub));
return this; return this;
} }
public isArray(): boolean { return true; } public isArray(): boolean {
public isArrayOrObject(): boolean { return true; } return true;
}
public isArrayOrObject(): boolean {
return true;
}
} }
export class ObjectDataItem extends Info { export class ObjectDataItem extends Info {}
}
export class ObjectData extends Info { export class ObjectData extends Info {
/** /**
@ -163,25 +199,29 @@ export class ObjectData extends Info {
} }
test() { test() {
this.data = JSON.stringify({ fack: 'test' }); this.data = JSON.stringify({ fack: "test" });
return this; return this;
} }
testProperty(): Property[] { testProperty(): Property[] {
const obj: Object = JSON.parse(this.data); const obj: Object = JSON.parse(this.data);
const properties: Property[] = []; const properties: Property[] = [];
for (let key in obj) { for (let key in obj) {
if (typeof obj[key] === 'string') { if (typeof obj[key] === "string") {
properties.push(new Property(key, new StringData(obj[key]))); properties.push(new Property(key, new StringData(obj[key])));
} else if (typeof obj[key] === 'number') { } else if (typeof obj[key] === "number") {
properties.push(new Property(key, new NumberData(obj[key]))); properties.push(new Property(key, new NumberData(obj[key])));
} else if (typeof obj[key] === 'boolean') { } else if (typeof obj[key] === "boolean") {
properties.push(new Property(key, new BoolData(obj[key]))); properties.push(new Property(key, new BoolData(obj[key])));
} }
} }
return properties; return properties;
} }
public isObject(): boolean { return true; } public isObject(): boolean {
public isArrayOrObject(): boolean { return true; } return true;
}
public isArrayOrObject(): boolean {
return true;
}
} }
export class InvalidData extends Info { export class InvalidData extends Info {
@ -197,7 +237,9 @@ export class InvalidData extends Info {
this.data = data.data; this.data = data.data;
return this; return this;
} }
public isInvalid(): boolean { return true; } public isInvalid(): boolean {
return true;
}
} }
export class ColorData extends Info { export class ColorData extends Info {
@ -212,7 +254,9 @@ export class ColorData extends Info {
this.data = data.data; this.data = data.data;
return this; return this;
} }
public isColor(): boolean { return true; } public isColor(): boolean {
return true;
}
} }
export class StringData extends Info { export class StringData extends Info {
@ -227,7 +271,9 @@ export class StringData extends Info {
this.data = data.data; this.data = data.data;
return this; return this;
} }
public isString(): boolean { return true; } public isString(): boolean {
return true;
}
} }
export class NumberData extends Info { export class NumberData extends Info {
@ -242,7 +288,9 @@ export class NumberData extends Info {
this.data = data.data; this.data = data.data;
return this; return this;
} }
public isNumber(): boolean { return true; } public isNumber(): boolean {
return true;
}
} }
export class BoolData extends Info { export class BoolData extends Info {
@ -257,7 +305,9 @@ export class BoolData extends Info {
this.data = data.data; this.data = data.data;
return this; return this;
} }
public isBool(): boolean { return true; } public isBool(): boolean {
return true;
}
} }
export class Vec2Data extends Info { export class Vec2Data extends Info {
@ -265,7 +315,7 @@ export class Vec2Data extends Info {
constructor() { constructor() {
super(); super();
this.type = DataType.Vec2 this.type = DataType.Vec2;
this.data = []; this.data = [];
return this; return this;
} }
@ -376,15 +426,18 @@ export class ImageData extends Info {
return this; return this;
} }
test() { test() {
const cocos = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABz1JREFUaEO9WXuMHVUZ/32zfbHSQkDa3pkukALb7N6ZUjFGjBFjopCUBA1PRYyJaVIVMVTF3rlbhAh7z922EB8oVRKNlUcgSAwCMWAQlKg0msjOzPYFwdCdMy3U2tqy7Xbvzmfm7t7dO/fO7Jx799b5c77X73fOd77znXMIHfx04e6TttnbQZeZrihTowWFXMnbSRqulIX8/41ERwkYD7zVyxMn94B5WNrWuha4t63aUQIRCr3svQfmDzLwWmCbn2gbmaJhxwnkhrznKeT1UXxmeiEo5q9VxNKWWucJDA6/SpoWjXzVtwbtiVG7/9a20CkYdZSAIbztDP4SwEsBOmsmPk8+LIuXf10BT8sqHSPQUx65qsL8cnCJtxQ333zSEO5pBhbWEBHhfr9g3t0ywgyDjhBY9eBfzgrHlx0i0FHfzl8YxTSEV2KwXR9/krHpUNH8QSdJdISAUXLfZPAlXUsnjAN3XCFrAHXh+QDrdYAZC7puk3f1Pd4pEvMmkCt5zxPxegYOBraZiwH72d+79f8sOQGeWtDVj7mCicp6ec+HXuoEiXkRWFX2CiGziICMn72w7993rNnTCEoveb8H8TXRf6pFYzpVCSsfOTRwuTtfEm0TuFDsW13B6b0AFgD0nrTzy9PAGCX3fSZ018sZON61+JyLR7/Vc6T+v36/c4vcYj2pSqxtAkbJOcpE51Rr/YJFV47e1ft6WtAVg7tv7dImH2uW02Fp5y+o/58Tzh8D2/rUGSWgC2cEoL5qEKLDshAHkRRcF85+gC5NkI1K2+yZXfjuCWmbZ58xAnrJeRREX6wF6OpafM2B7172okpAXbiT1c256aN90s6vWbl9f782Me5J21TODGXFKOby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bMRzKU/2r947P3xU0kgCfyCb1tzXowpEYicV8Lule8OrD7U7iin2eWE+yABm5LkDHICO7923jMQOSCiXX4hr9QhtkJSF94egNck2oQI5IBZvdXIDf3z+mBzc+ebUoW8pwh8U4PTM1KFdOFG6ZNc3QjHu/13LhjTL3qdWNvtF/u+0Eg0eR8ouQ+BcHv1GoFnN0oKsdEfMH/eyghn6erC4VijWGfAQIU4ul4Fpe0JiQQM4d7NwPcbgzNjJCia+SxQqnJj0LmWNXquWX/m/mVaxH+TtvWx5IWe8De3dWQDTSZ0iqRNykJ/agusCrymlys7TxPTDRl2FWmbM3esSilklJ0iQIN12TNjx4SdQcH8cqtgk/R14f0L4IuqsihTE/KBQE/6dv7zafFSt+pc2b2PGFuaDBn/lXWntfkQMYR7koElVR/NjW908tgRZBxq5uw19LK3DczfaQSpTeLG0S3mb+YDPrLVhTcJcGLDxuCdgW1lznRms6QL98cAGnug3dI2+9slYAztuZHDyk40dqA1h0RPyUL+FhX/mQSqI1Xyfgri2fMp81ECXvaLVtYCbMKgl4b3grTexJypZhL9zrfz16mAr2Wekq5ecraBKJ5OzBUCnlUhogtnOxF9M36+jocm8B982/qMEqBpJaUZqDnUB517odE9zQGqRB73E3I2N7Svj8LxFwGKH5Aaqg4Dfw5s86pWwLc0AzMkhLMdoG8nB+IKCL+SBWvDVOo5L4Ho01mgmGlXUGyvz2ppBmpAjLK3g5k3phZvILqQGgeg0oK/IW2z7Vf9tghMja77GAhN779N5Txlg5oejHlVs7ZSqD4d9JI7/XxEaUVlVr2eSPVym9+SBTPpvSAr42Lytmcg8rJi25vLuyZO7gVRi5e8fFjaVuxlpiXUdcr/A3Hqok9HdvAQAAAAAElFTkSuQmCC";
this.data = cocos; this.data = cocos;
return this; return this;
} }
public isImage(): boolean { return true; } public isImage(): boolean {
return true;
}
} }
export class EnumData extends Info { export class EnumData extends Info {
public values: Array<{ name: string, value: any }> = []; public values: Array<{ name: string; value: any }> = [];
constructor() { constructor() {
super(); super();
this.type = DataType.Enum; this.type = DataType.Enum;
@ -474,7 +527,7 @@ export class Property {
break; break;
case DataType.ObjectItem: case DataType.ObjectItem:
default: default:
throw new Error(`not support type: ${typeof data === 'string' ? data : JSON.stringify(data)}`); throw new Error(`not support type: ${typeof data === "string" ? data : JSON.stringify(data)}`);
} }
return this; return this;
} }
@ -490,7 +543,7 @@ export class Group {
constructor(name: string, id?: string) { constructor(name: string, id?: string) {
this.name = name; this.name = name;
this.id = id || ''; this.id = id || "";
} }
parse(data: Group) { parse(data: Group) {
this.id = data.id; this.id = data.id;
@ -504,7 +557,7 @@ export class Group {
return this; return this;
} }
addProperty(property: Property) { addProperty(property: Property) {
this.data.push(property) this.data.push(property);
} }
buildProperty(name: string, info: Info) { buildProperty(name: string, info: Info) {
const property = new Property(name, info); const property = new Property(name, info);
@ -516,16 +569,16 @@ export class Group {
let order = ["name", "active", "enabled", "uuid", "position", "rotation", "scale", "anchor", "size", "color", "opacity", "skew", "group"]; let order = ["name", "active", "enabled", "uuid", "position", "rotation", "scale", "anchor", "size", "color", "opacity", "skew", "group"];
let orderKeys: Array<Property> = []; let orderKeys: Array<Property> = [];
let otherKeys: Array<Property> = []; let otherKeys: Array<Property> = [];
this.data.forEach(property => { this.data.forEach((property) => {
if (order.find(el => el === property.name)) { if (order.find((el) => el === property.name)) {
orderKeys.push(property) orderKeys.push(property);
} else { } else {
otherKeys.push(property); otherKeys.push(property);
} }
}) });
orderKeys.sort((a, b) => { orderKeys.sort((a, b) => {
return order.indexOf(a.name) - order.indexOf(b.name); return order.indexOf(a.name) - order.indexOf(b.name);
}) });
otherKeys.sort(); otherKeys.sort();
this.data = orderKeys.concat(otherKeys); this.data = orderKeys.concat(otherKeys);
} }

View File

@ -2,12 +2,12 @@ import ccui from "@xuyanfeng/cc-ui";
import "@xuyanfeng/cc-ui/dist/ccui.css"; import "@xuyanfeng/cc-ui/dist/ccui.css";
import "@xuyanfeng/cc-ui/iconfont/iconfont.css"; import "@xuyanfeng/cc-ui/iconfont/iconfont.css";
import CCP from "cc-plugin/src/ccp/entry-render"; import CCP from "cc-plugin/src/ccp/entry-render";
import { createPinia } from 'pinia'; import { createPinia } from "pinia";
import { createApp } from "vue"; import { createApp } from "vue";
import pluginConfig from "../../../cc-plugin.config"; import pluginConfig from "../../../cc-plugin.config";
import "../global.less"; import "../global.less";
import App from "./index.vue"; import App from "./index.vue";
import { init } from './register-panel'; import { init } from "./register-panel";
export default CCP.init(pluginConfig, { export default CCP.init(pluginConfig, {
ready: function (rootElement: any, args: any) { ready: function (rootElement: any, args: any) {
init(); init();

View File

@ -42,13 +42,12 @@
import ccui from "@xuyanfeng/cc-ui"; import ccui from "@xuyanfeng/cc-ui";
import { ButtonGroupItem } from "@xuyanfeng/cc-ui/types/cc-button-group/const"; import { ButtonGroupItem } from "@xuyanfeng/cc-ui/types/cc-button-group/const";
import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const"; import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const";
import { ITreeData } from "@xuyanfeng/cc-ui/types/cc-tree/const"; import { storeToRefs } from "pinia";
import { _UnwrapAll, Store, storeToRefs } from "pinia"; import { defineComponent, nextTick, onMounted, reactive, ref, toRaw, watch } from "vue";
import { defineComponent, nextTick, onMounted, PropType, reactive, Ref, ref, toRaw, watch } from "vue";
import PluginConfig from "../../../cc-plugin.config"; import PluginConfig from "../../../cc-plugin.config";
import { Msg, Page, PluginEvent } from "../../core/types"; import { Msg, PluginEvent } from "../../core/types";
import Bus, { BusMsg } from "./bus";
import { bridge } from "./bridge"; import { bridge } from "./bridge";
import Bus, { BusMsg } from "./bus";
import { EngineData, FrameDetails, Info, NodeInfoData, ObjectData, ObjectItemRequestData, TreeData } from "./data"; import { EngineData, FrameDetails, Info, NodeInfoData, ObjectData, ObjectItemRequestData, TreeData } from "./data";
import { appStore, RefreshType } from "./store"; import { appStore, RefreshType } from "./store";
import Test from "./test/test.vue"; import Test from "./test/test.vue";

View File

@ -1,7 +1,5 @@
import CCP from "cc-plugin/src/ccp/entry-render"; import CCP from "cc-plugin/src/ccp/entry-render";
import { ChromeConst } from "cc-plugin/src/chrome/const"; import { ChromeConst } from "cc-plugin/src/chrome/const";
import { bridge } from "./bridge";
import { Msg } from "../../core/types";
export function init() { export function init() {
if (chrome && chrome.devtools) { if (chrome && chrome.devtools) {
// 对应的是Elements面板的边栏 // 对应的是Elements面板的边栏
@ -12,8 +10,8 @@ export function init() {
// 创建devtools-panel // 创建devtools-panel
let iconPath = ""; let iconPath = "";
const { icon } = CCP.manifest; const { icon } = CCP.manifest;
if (icon && icon['48']) { if (icon && icon["48"]) {
iconPath = icon['48']; iconPath = icon["48"];
} }
chrome.devtools.panels.create(CCP.manifest.name, iconPath, ChromeConst.html.devtools, (panel: chrome.devtools.panels.ExtensionPanel) => { chrome.devtools.panels.create(CCP.manifest.name, iconPath, ChromeConst.html.devtools, (panel: chrome.devtools.panels.ExtensionPanel) => {
console.log("[CC-Inspector] Dev Panel Created!"); console.log("[CC-Inspector] Dev Panel Created!");
@ -30,7 +28,6 @@ export function init() {
// ctrl+f 查找触发 // ctrl+f 查找触发
console.log("panel search!"); console.log("panel search!");
}); });
} });
);
} }
} }

View File

@ -36,5 +36,5 @@ export const appStore = defineStore("app", () => {
const cfg = toRaw(config.value); const cfg = toRaw(config.value);
profile.save(cfg); profile.save(cfg);
}, },
} };
}); });

View File

@ -2,9 +2,7 @@ import { v4 } from "uuid";
import { Msg, Page, PluginEvent } from "../../../core/types"; import { Msg, Page, PluginEvent } from "../../../core/types";
import { ArrayData, BoolData, ColorData, EngineData, EnumData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectData, ObjectItemRequestData, Property, StringData, TextData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../data"; import { ArrayData, BoolData, ColorData, EngineData, EnumData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectData, ObjectItemRequestData, Property, StringData, TextData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../data";
export class TestClient { export class TestClient {
recv(event: PluginEvent) { recv(event: PluginEvent) {}
}
} }
class Node { class Node {
active: boolean = true; active: boolean = true;
@ -19,7 +17,7 @@ class Node {
this.children = []; this.children = [];
} }
buildComponent(name: string) { buildComponent(name: string) {
const info = new Group(name) const info = new Group(name);
this.components.push(info); this.components.push(info);
return info; return info;
} }
@ -43,17 +41,17 @@ class Node {
private allNodes(): Node[] { private allNodes(): Node[] {
const nodes: Node[] = []; const nodes: Node[] = [];
function circle(node: Node) { function circle(node: Node) {
node.children.forEach(child => { node.children.forEach((child) => {
nodes.push(child); nodes.push(child);
circle(child); circle(child);
}) });
} }
circle(this); circle(this);
return nodes; return nodes;
} }
findNode(id: string): Node | null { findNode(id: string): Node | null {
const nodes: Node[] = this.allNodes(); const nodes: Node[] = this.allNodes();
return nodes.find(node => node.id === id) || null; return nodes.find((node) => node.id === id) || null;
} }
findInfo(id: string): Info | null { findInfo(id: string): Info | null {
const nodes: Node[] = this.allNodes(); const nodes: Node[] = this.allNodes();
@ -83,42 +81,19 @@ export class TestServer {
private clients: TestClient[] = []; private clients: TestClient[] = [];
private testData: Node = new Node("scene"); private testData: Node = new Node("scene");
constructor() { constructor() {
this.testData.buildChild("base").buildComponent("group1") this.testData.buildChild("base").buildComponent("group1").buildProperty("bool", new BoolData(true)).buildProperty("text", new TextData("text")).buildProperty("number", new NumberData(100)).buildProperty("string", new StringData("string")).buildProperty("enum", new EnumData().test()).buildProperty("color", new ColorData("#f00")).buildProperty("image", new ImageData().test());
.buildProperty('bool', new BoolData(true)) this.testData.buildChild("vec").buildComponent("group2").buildProperty("number", new NumberData(200)).buildProperty("vec2", new Vec2Data().test()).buildProperty("vec3", new Vec3Data().test()).buildProperty("vec4", new Vec4Data().test());
.buildProperty("text", new TextData("text")) this.testData.buildChild("obj/arr").buildComponent("group3").buildProperty("array", new ArrayData().test()).buildProperty("object", new ObjectData().test()).buildProperty("arr_arr", new ArrayData().testSub());
.buildProperty("number", new NumberData(100)) this.testData.buildChild("engine").buildComponent("group4").buildProperty("node", new EngineData().init("name", "cc_Node", "uuid")).buildProperty("sprite", new EngineData().init("name", "cc_Sprite", "uuid")).buildProperty("label", new EngineData().init("name", "cc_Label", "uuid")).buildProperty("un_known", new EngineData().init("name", "un_known", "uuid"));
.buildProperty("string", new StringData("string"))
.buildProperty("enum", new EnumData().test())
.buildProperty("color", new ColorData('#f00'))
.buildProperty("image", new ImageData().test())
this.testData.buildChild('vec').buildComponent('group2')
.buildProperty("number", new NumberData(200))
.buildProperty("vec2", new Vec2Data().test())
.buildProperty("vec3", new Vec3Data().test())
.buildProperty("vec4", new Vec4Data().test())
this.testData.buildChild("obj/arr").buildComponent("group3")
.buildProperty("array", new ArrayData().test())
.buildProperty("object", new ObjectData().test())
.buildProperty("arr_arr", new ArrayData().testSub())
this.testData.buildChild("engine").buildComponent("group4")
.buildProperty("node", new EngineData().init('name', 'cc_Node', 'uuid'))
.buildProperty("sprite", new EngineData().init('name', 'cc_Sprite', 'uuid'))
.buildProperty("label", new EngineData().init('name', 'cc_Label', 'uuid'))
.buildProperty("un_known", new EngineData().init('name', 'un_known', 'uuid'))
const c = this.testData.buildChild("str1") const c = this.testData.buildChild("str1");
c.active = false; c.active = false;
c.buildComponent("group51").buildProperty("str1", new StringData("str1")) c.buildComponent("group51").buildProperty("str1", new StringData("str1"));
c.buildComponent("group52").buildProperty("num", new NumberData(200)) c.buildComponent("group52").buildProperty("num", new NumberData(200));
this.testData.buildChild("str2").buildComponent("group6") this.testData.buildChild("str2").buildComponent("group6").buildProperty("str2", new StringData("str2"));
.buildProperty("str2", new StringData("str2"))
this.testData.buildChild("Invalid").buildComponent("group7") this.testData.buildChild("Invalid").buildComponent("group7").buildProperty("NaN", new InvalidData(NaN)).buildProperty("null", new InvalidData(null)).buildProperty("Infinity", new InvalidData(Infinity)).buildProperty("undefined", new InvalidData(undefined));
.buildProperty("NaN", new InvalidData(NaN))
.buildProperty("null", new InvalidData(null))
.buildProperty("Infinity", new InvalidData(Infinity))
.buildProperty("undefined", new InvalidData(undefined))
} }
add(client: TestClient) { add(client: TestClient) {
this.clients.push(client); this.clients.push(client);
@ -158,9 +133,9 @@ export class TestServer {
const ret: ObjectItemRequestData = { const ret: ObjectItemRequestData = {
id: objData.id, id: objData.id,
data: info.testProperty(), data: info.testProperty(),
} };
const event = new PluginEvent(Page.Inject, Page.Devtools, Msg.GetObjectItemData, ret); const event = new PluginEvent(Page.Inject, Page.Devtools, Msg.GetObjectItemData, ret);
this.send(event) this.send(event);
} else { } else {
console.warn("not found data: ", objData.id); console.warn("not found data: ", objData.id);
} }
@ -176,7 +151,7 @@ export class TestServer {
} }
send(event: PluginEvent) { send(event: PluginEvent) {
this.clients.forEach((client) => { this.clients.forEach((client) => {
client.recv(event) client.recv(event);
}); });
} }
} }

View File

@ -13,15 +13,14 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import ccui from "@xuyanfeng/cc-ui"; import ccui from "@xuyanfeng/cc-ui";
import { ITreeData } from "@xuyanfeng/cc-ui/types/cc-tree/const"; import { storeToRefs } from "pinia";
import { defineComponent, ref } from "vue"; import { defineComponent, ref } from "vue";
import { Msg, Page, PluginEvent } from "../../../core/types"; import { Msg, Page, PluginEvent } from "../../../core/types";
import { bridge } from "../bridge";
import { appStore, RefreshType } from "../store";
import { storeToRefs } from "pinia";
import { FrameDetails, Group, Info, InvalidData, NodeInfoData, TreeData } from "../data";
import { testServer, TestServer } from "./server";
import { Terminal } from "../../../scripts/terminal"; import { Terminal } from "../../../scripts/terminal";
import { bridge } from "../bridge";
import { FrameDetails, Group, InvalidData, NodeInfoData, TreeData } from "../data";
import { appStore } from "../store";
import { testServer } from "./server";
const { CCButton, CCSection } = ccui.components; const { CCButton, CCSection } = ccui.components;
export default defineComponent({ export default defineComponent({
name: "test", name: "test",

View File

@ -10,10 +10,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import ccui from "@xuyanfeng/cc-ui"; import { defineComponent, PropType } from "vue";
import { defineComponent, PropType, ref } from "vue";
import Bus, { BusMsg } from "../bus"; import Bus, { BusMsg } from "../bus";
import { EngineData, NumberData, Property } from "../data"; import { EngineData } from "../data";
export default defineComponent({ export default defineComponent({
name: "property-engine", name: "property-engine",
components: {}, components: {},

View File

@ -7,7 +7,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, PropType, watch } from "vue"; import { defineComponent, PropType, watch } from "vue";
import Bus, { BusMsg } from "../bus"; import Bus, { BusMsg } from "../bus";
import { Group, NodeInfoData } from "../data"; import { NodeInfoData } from "../data";
import PropertyGroup from "../ui/property-group.vue"; import PropertyGroup from "../ui/property-group.vue";
import UiProp from "./ui-prop.vue"; import UiProp from "./ui-prop.vue";

View File

@ -14,7 +14,7 @@
import ccui from "@xuyanfeng/cc-ui"; import ccui from "@xuyanfeng/cc-ui";
import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const"; import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { defineComponent, onMounted, ref, toRaw } from "vue"; import { defineComponent, ref } from "vue";
import bus, { BusMsg } from "../bus"; import bus, { BusMsg } from "../bus";
import { appStore, RefreshType } from "../store"; import { appStore, RefreshType } from "../store";
const { CCInput, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCProp, CCColor } = ccui.components; const { CCInput, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCProp, CCColor } = ccui.components;

View File

@ -31,12 +31,11 @@
<script lang="ts"> <script lang="ts">
import ccui from "@xuyanfeng/cc-ui"; import ccui from "@xuyanfeng/cc-ui";
import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const"; import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const";
import { nextTick } from "process"; import { defineComponent, onMounted, PropType, ref, toRaw, watch } from "vue";
import { defineComponent, onMounted, onUnmounted, PropType, ref, toRaw, watch } from "vue";
import { Msg } from "../../../core/types"; import { Msg } from "../../../core/types";
import Bus, { BusMsg } from "../bus";
import { bridge } from "../bridge"; import { bridge } from "../bridge";
import { DataType, EngineData, EnumData, ImageData, Info, NumberData, Property, StringData, TextData, Vec2Data, Vec3Data } from "../data"; import Bus, { BusMsg } from "../bus";
import { EngineData, EnumData, ImageData, Info, NumberData, Property, StringData, TextData, Vec2Data, Vec3Data } from "../data";
import Engine from "./property-engine.vue"; import Engine from "./property-engine.vue";
import PropertyImage from "./property-image.vue"; import PropertyImage from "./property-image.vue";
const { CCInput, CCTextarea, CCProp, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor } = ccui.components; const { CCInput, CCTextarea, CCProp, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor } = ccui.components;

View File

@ -5,7 +5,7 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, nextTick, onMounted, provide, ref } from "vue"; import { defineComponent } from "vue";
export default defineComponent({ export default defineComponent({
name: "options", name: "options",
components: {}, components: {},