diff --git a/source/.eslintrc.js b/source/.eslintrc.js index 0822ac6..a8288ce 100644 --- a/source/.eslintrc.js +++ b/source/.eslintrc.js @@ -42,6 +42,7 @@ module.exports = { "@typescript-eslint/no-explicit-any": "off", "no-prototype-builtins": "off", "@typescript-eslint/ban-ts-comment": "off", - "no-inner-declarations":"off", + "no-inner-declarations": "off", + "vue/no-unused-vars": "off", } }; diff --git a/source/src/devtools/data.ts b/source/src/devtools/data.ts index 0fd94c1..8a63ed9 100644 --- a/source/src/devtools/data.ts +++ b/source/src/devtools/data.ts @@ -117,6 +117,7 @@ export class EnumData extends Info { } export class TreeData { + active: boolean = true; uuid: string = ''; name: string = ''; children: Array = []; @@ -145,7 +146,7 @@ export class Group { } sort() { - let order = ['name', '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 = []; let otherKeys: Array = []; this.data.forEach(property => { diff --git a/source/src/devtools/index.vue b/source/src/devtools/index.vue index 76eb54c..28497c7 100644 --- a/source/src/devtools/index.vue +++ b/source/src/devtools/index.vue @@ -27,7 +27,13 @@ node-key="uuid" @node-expand="onNodeExpand" @node-collapse="onNodeCollapse" - @node-click="handleNodeClick"> + @node-click="handleNodeClick"> + + + {{ node.label }} + + +
@@ -175,24 +181,26 @@ export default class Index extends Vue { const uuid = data.path[0]; const key = data.path[1]; const value = data.data; - if (key === 'name') { - let treeArray: Array = []; + let treeArray: Array = []; - function circle(array: Array) { - array.forEach(item => { - treeArray.push(item); - circle(item.children); - }) - } - - // 更新指定uuid节点的tree的name - circle(this.treeData) - let ret = treeArray.find(el => el.uuid === uuid); - if (ret) { - ret.name = value; - } + function circle(array: Array) { + array.forEach(item => { + treeArray.push(item); + circle(item.children); + }) } + // 更新指定uuid节点的tree的name + circle(this.treeData) + let ret = treeArray.find(el => el.uuid === uuid); + if (ret) { + if (key === 'name') { + ret.name = value; + } + if (key === 'active') { + ret.active = !!value; + } + } } handleNodeClick(data: TreeData) { @@ -319,6 +327,18 @@ export default class Index extends Vue { overflow: auto; width: 300px; + .leaf { + width: 100%; + } + + .leaf-show { + color: black; + } + + .leaf-hide { + color: #c7bbbb; + text-decoration: line-through; + } &::-webkit-scrollbar { width: 6px; diff --git a/source/src/devtools/inject.ts b/source/src/devtools/inject.ts index 2bccd09..8424991 100644 --- a/source/src/devtools/inject.ts +++ b/source/src/devtools/inject.ts @@ -102,6 +102,12 @@ class CCInspector { getNodeChildren(node: any, data: TreeData) { data.uuid = node.uuid; data.name = node.name; + // @ts-ignore + if (node instanceof cc.Scene) { + // 场景不允许获取active,引擎会报错 + } else { + data.active = !!node.active; + } this.inspectorGameMemoryStorage[node.uuid] = node; let nodeChildren = node.getChildren(); for (let i = 0; i < nodeChildren.length; i++) {