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