mirror of
				https://github.com/tidys/cc-inspector-chrome
				synced 2025-10-31 22:15:25 +00:00 
			
		
		
		
	active
This commit is contained in:
		| @@ -42,6 +42,7 @@ module.exports = { | |||||||
|     "@typescript-eslint/no-explicit-any": "off", |     "@typescript-eslint/no-explicit-any": "off", | ||||||
|     "no-prototype-builtins": "off", |     "no-prototype-builtins": "off", | ||||||
|     "@typescript-eslint/ban-ts-comment": "off", |     "@typescript-eslint/ban-ts-comment": "off", | ||||||
|     "no-inner-declarations":"off", |     "no-inner-declarations": "off", | ||||||
|  |     "vue/no-unused-vars": "off", | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -117,6 +117,7 @@ export class EnumData extends Info { | |||||||
| } | } | ||||||
|  |  | ||||||
| export class TreeData { | export class TreeData { | ||||||
|  |   active: boolean = true; | ||||||
|   uuid: string = ''; |   uuid: string = ''; | ||||||
|   name: string = ''; |   name: string = ''; | ||||||
|   children: Array<TreeData> = []; |   children: Array<TreeData> = []; | ||||||
| @@ -145,7 +146,7 @@ export class Group { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   sort() { |   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<Property> = []; |     let orderKeys: Array<Property> = []; | ||||||
|     let otherKeys: Array<Property> = []; |     let otherKeys: Array<Property> = []; | ||||||
|     this.data.forEach(property => { |     this.data.forEach(property => { | ||||||
|   | |||||||
| @@ -27,7 +27,13 @@ | |||||||
|                    node-key="uuid" |                    node-key="uuid" | ||||||
|                    @node-expand="onNodeExpand" |                    @node-expand="onNodeExpand" | ||||||
|                    @node-collapse="onNodeCollapse" |                    @node-collapse="onNodeCollapse" | ||||||
|                    @node-click="handleNodeClick"></el-tree> |                    @node-click="handleNodeClick"> | ||||||
|  |  | ||||||
|  |             <span slot-scope="{node,data}" class="leaf" :class="data.active?'leaf-show':'leaf-hide'"> | ||||||
|  |               <span>{{ node.label }}</span> | ||||||
|  |               <!--              <el-button v-if="!!data||true"> 显示</el-button>--> | ||||||
|  |             </span> | ||||||
|  |           </el-tree> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|       <div class="right"> |       <div class="right"> | ||||||
| @@ -175,24 +181,26 @@ export default class Index extends Vue { | |||||||
|     const uuid = data.path[0]; |     const uuid = data.path[0]; | ||||||
|     const key = data.path[1]; |     const key = data.path[1]; | ||||||
|     const value = data.data; |     const value = data.data; | ||||||
|     if (key === 'name') { |     let treeArray: Array<TreeData> = []; | ||||||
|       let treeArray: Array<TreeData> = []; |  | ||||||
|  |  | ||||||
|       function circle(array: Array<TreeData>) { |     function circle(array: Array<TreeData>) { | ||||||
|         array.forEach(item => { |       array.forEach(item => { | ||||||
|           treeArray.push(item); |         treeArray.push(item); | ||||||
|           circle(item.children); |         circle(item.children); | ||||||
|         }) |       }) | ||||||
|       } |  | ||||||
|  |  | ||||||
|       // 更新指定uuid节点的tree的name |  | ||||||
|       circle(this.treeData) |  | ||||||
|       let ret = treeArray.find(el => el.uuid === uuid); |  | ||||||
|       if (ret) { |  | ||||||
|         ret.name = value; |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     // 更新指定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) { |   handleNodeClick(data: TreeData) { | ||||||
| @@ -319,6 +327,18 @@ export default class Index extends Vue { | |||||||
|         overflow: auto; |         overflow: auto; | ||||||
|         width: 300px; |         width: 300px; | ||||||
|  |  | ||||||
|  |         .leaf { | ||||||
|  |           width: 100%; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .leaf-show { | ||||||
|  |           color: black; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .leaf-hide { | ||||||
|  |           color: #c7bbbb; | ||||||
|  |           text-decoration: line-through; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         &::-webkit-scrollbar { |         &::-webkit-scrollbar { | ||||||
|           width: 6px; |           width: 6px; | ||||||
|   | |||||||
| @@ -102,6 +102,12 @@ class CCInspector { | |||||||
|   getNodeChildren(node: any, data: TreeData) { |   getNodeChildren(node: any, data: TreeData) { | ||||||
|     data.uuid = node.uuid; |     data.uuid = node.uuid; | ||||||
|     data.name = node.name; |     data.name = node.name; | ||||||
|  |     // @ts-ignore | ||||||
|  |     if (node instanceof cc.Scene) { | ||||||
|  |       // 场景不允许获取active,引擎会报错 | ||||||
|  |     } else { | ||||||
|  |       data.active = !!node.active; | ||||||
|  |     } | ||||||
|     this.inspectorGameMemoryStorage[node.uuid] = node; |     this.inspectorGameMemoryStorage[node.uuid] = node; | ||||||
|     let nodeChildren = node.getChildren(); |     let nodeChildren = node.getChildren(); | ||||||
|     for (let i = 0; i < nodeChildren.length; i++) { |     for (let i = 0; i < nodeChildren.length; i++) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user