mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-19 16:38:41 +00:00
bugfix
This commit is contained in:
parent
9adb53e4e5
commit
96e8a883a4
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "app",
|
||||
"version": "0.2.0",
|
||||
"name": "cc-inspector",
|
||||
"version": "2.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
@ -22,6 +22,7 @@ import {BuildArrayOptions, BuildImageOptions, BuildObjectOptions, BuildVecOption
|
||||
// @ts-ignore
|
||||
import {uniq} from "lodash"
|
||||
import {trySetValueWithConfig, getValue} from "@/inject/setValue";
|
||||
import {isHasProperty} from "@/inject/util";
|
||||
|
||||
declare const cc: any;
|
||||
|
||||
@ -507,15 +508,25 @@ class CCInspector {
|
||||
return comp.constructor.name;
|
||||
}
|
||||
|
||||
// 校验keys的有效性,3.x有position,没有x,y,z
|
||||
_checkKeysValid(obj: any, keys: string[]) {
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
if (!isHasProperty(obj, key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
_getGroupData(node: any) {
|
||||
const name = this.getCompName(node);
|
||||
let nodeGroup = new Group(name);
|
||||
let keys = this._getNodeKeys(node);
|
||||
for (let i = 0; i < keys.length;) {
|
||||
let key = keys[i];
|
||||
let propertyValue = node[key];
|
||||
let pair = this._getPairProperty(key);
|
||||
if (pair) {
|
||||
if (pair && this._checkKeysValid(node, pair.values)) {
|
||||
let bSplice = false;
|
||||
// 把这个成对的属性剔除掉
|
||||
pair.values.forEach((item: string) => {
|
||||
@ -538,15 +549,11 @@ class CCInspector {
|
||||
}
|
||||
// todo path
|
||||
pairValues.forEach((el: string) => {
|
||||
if (el in node) {
|
||||
let propertyPath = [node.uuid, el];
|
||||
let vecData = this._genInfoData(node, el, propertyPath);
|
||||
if (vecData) {
|
||||
info && info.add(new Property(el, vecData));
|
||||
}
|
||||
} else {
|
||||
console.warn(`属性异常,节点丢失属性: ${el},请检查 pairProperty的设置`);
|
||||
}
|
||||
});
|
||||
if (info) {
|
||||
let property = new Property(pair.key, info);
|
||||
|
@ -1,4 +1,5 @@
|
||||
declare const cc: any;
|
||||
|
||||
export function isVersion3() {
|
||||
if (typeof cc.ENGINE_VERSION === "string") {
|
||||
const version: string = cc.ENGINE_VERSION;
|
||||
@ -6,3 +7,17 @@ export function isVersion3() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isHasProperty(base: Object, key: string): boolean {
|
||||
let ret = Object.getOwnPropertyDescriptor(base, key)
|
||||
if (ret) {
|
||||
return true;
|
||||
} else {
|
||||
let proto = Object.getPrototypeOf(base);
|
||||
if (proto) {
|
||||
return isHasProperty(proto, key)
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"version": "1.1.0",
|
||||
"version": "2.0.0",
|
||||
"name": "Cocos Creator Inspector",
|
||||
"description": "Cocos Creator Inspector",
|
||||
"permissions": [
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
|
||||
<div class="foot">
|
||||
<div class="space"></div>
|
||||
<a href="https://tidys.gitee.io/doc/#" target="_blank">
|
||||
<img class="icon" src="./res/tiezi.png" alt="">
|
||||
</a>
|
||||
@ -30,6 +29,8 @@
|
||||
<a href="https://jq.qq.com/?_wv=1027&k=5SdPdy2" target="_blank">
|
||||
<img class="icon" src="./res/qq.png" alt="">
|
||||
</a>
|
||||
<div class="space"></div>
|
||||
<div v-if="version">ver:{{ version }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -38,6 +39,7 @@
|
||||
<script lang="ts">
|
||||
import {Component, Vue} from "vue-property-decorator";
|
||||
import Manifest from "../manifest.json"
|
||||
import {version} from "../../package.json"
|
||||
|
||||
@Component({
|
||||
components: {},
|
||||
@ -48,7 +50,7 @@ export default class App extends Vue {
|
||||
data() {
|
||||
return {
|
||||
title: "cc-inspector",
|
||||
isShowMoneyPng: true,
|
||||
version: version,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user