mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-10-23 00:35:23 +00:00
小助手增加了一些右键的设置
This commit is contained in:
@@ -2,6 +2,7 @@ import ccui from "@xuyanfeng/cc-ui";
|
||||
import "@xuyanfeng/cc-ui/dist/ccui.css";
|
||||
import "@xuyanfeng/cc-ui/iconfont/iconfont.css";
|
||||
import { createApp } from "vue";
|
||||
import { createPinia } from "pinia";
|
||||
import { DocumentEvent } from "../const";
|
||||
import App from "../inject-view/app.vue";
|
||||
export class InjectView {
|
||||
@@ -45,6 +46,7 @@ export class InjectView {
|
||||
this.loadCss();
|
||||
// vue
|
||||
const app = createApp(App);
|
||||
app.use(createPinia());
|
||||
// ccui.uiElement.setDoc(document);
|
||||
app.use(ccui);
|
||||
app.mount(el);
|
||||
|
38
cc-inspector/src/scripts/inject/inspect-list.ts
Normal file
38
cc-inspector/src/scripts/inject/inspect-list.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
export class InspectTarget {
|
||||
private list = [];
|
||||
|
||||
/**
|
||||
* 是否启用过滤
|
||||
*/
|
||||
enabled: boolean = false;
|
||||
addInspectType(item: any) {
|
||||
if (!this.list.find((el) => item === el)) {
|
||||
this.list.push(item);
|
||||
}
|
||||
console.log(this.list);
|
||||
}
|
||||
|
||||
removeInspectType(item: any) {
|
||||
this.list.splice(this.list.indexOf(item), 1);
|
||||
console.log(this.list);
|
||||
}
|
||||
cleanInspectType() {
|
||||
this.list.length = 0;
|
||||
}
|
||||
isContainInspectType(type: any) {
|
||||
return !!this.list.find((el) => type === el);
|
||||
}
|
||||
|
||||
checkNodeComponentsIsInList(node: any) {
|
||||
const comps = node._components;
|
||||
for (let i = 0; i < comps.length; i++) {
|
||||
const comp = comps[i];
|
||||
if (this.list.find((el) => comp instanceof el)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export const inspectTarget = new InspectTarget();
|
@@ -8,6 +8,8 @@ import { injectView } from "./inject-view";
|
||||
import { getValue, trySetValueWithConfig } from "./setValue";
|
||||
import { BuildArrayOptions, BuildImageOptions, BuildObjectOptions, BuildVecOptions } from "./types";
|
||||
import { isHasProperty } from "./util";
|
||||
import { inspectTarget } from "./inspect-list";
|
||||
|
||||
declare const cc: any;
|
||||
|
||||
export class Inspector extends InjectEvent {
|
||||
@@ -200,7 +202,13 @@ export class Inspector extends InjectEvent {
|
||||
for (let key in this.inspectorGameMemoryStorage) {
|
||||
const item = this.inspectorGameMemoryStorage[key];
|
||||
if (item && item.isValid && item instanceof cc.Node) {
|
||||
cb(item);
|
||||
if (inspectTarget.enabled) {
|
||||
if (inspectTarget.checkNodeComponentsIsInList(item)) {
|
||||
cb(item);
|
||||
}
|
||||
} else {
|
||||
cb(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user