1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- CMD:
- console.log("====>>>>远程脚本加载成功");
- //var cScene = cc.director.getScene();
- //let scene = cc.director.getScene();
- //let layersCount = scene.childrenCount;
- //console.log("图层数量:", layersCount);
- //
- //function getTotalComponentsCount(node) {
- // let count = node.getComponents(cc.Component).length;
- // node.children.forEach(childNode => {
- // count += getTotalComponentsCount(childNode);
- // });
- // return count;
- //}
- //
- //// 使用当前场景的根节点作为起点
- //let totalComponents = getTotalComponentsCount(scene);
- //console.log("场景中的组件总数量:", totalComponents);
- //function printNodePath(node, path = '') {
- // // 构建当前节点的路径
- // let currentPath = path ? `${path}/${node.name}` : node.name;
- // console.log(currentPath); // 打印当前节点的路径
- // lws.send(currentPath);
- // // 遍历子节点
- // node.children.forEach((child) => {
- // printNodePath(child, currentPath);
- // });
- //}
- //
- // 获取当前场景的根节点并开始遍历
- //let scene = cc.director.getScene();
- //scene.children.forEach((child) => {
- // // 假设每个直接子节点都是一个“图层”
- // printNodePath(child);
- //});
- //
- //function printNodePath(node, path = '') {
- // // 构建当前节点的路径
- // let currentPath = path ? `${path}/${node.name}` : node.name;
- //
- // // 检查节点是否有 cc.Button 组件,这意味着它监听了点击事件
- // let buttonComponent = node.getComponent(cc.Button);
- //
- // // 可以根据需要,检查其他组件,如 cc.ScrollView 等
- //
- // if (buttonComponent) {
- // console.log(currentPath); // 打印当前节点的路径
- // lws.send(currentPath);
- // }
- //
- // // 遍历子节点
- // node.children.forEach((child) => {
- // printNodePath(child, currentPath);
- // });
- //}
- //// 获取当前场景的根节点并开始遍历
- //let scene = cc.director.getScene();
- //scene.children.forEach((child) => {
- // printNodePath(child);
- //});
- // 点击扑克大师游戏
- let pokerMasterGame = cc.find("Canvas/container/content/smallGame/createScrollView/view/cotent/row1/pokerNode/porkermaster/allHand");//进入大师线路列表
- //let pokerMasterGame = cc.find("Canvas/container/content/smallGame/New Node/listPokerMasterContent/btn_down");//大师线路列表按钮下降
- // 检查节点是否找到以及是否有cc.Button组件
- if (pokerMasterGame && pokerMasterGame.getComponent(cc.Button)) {
- // 模拟点击事件
- pokerMasterGame.getComponent(cc.Button).clickEvents[0].emit([pokerMasterGame]);
- } else {
- // console.error("节点未找到或节点上没有cc.Button组件");
- console.error("未找到扑克大师游戏");
- }
- // 点击扑克大师游戏线路1
- let pokerMasterGameLine1 = cc.find("Canvas/container/content/smallGame/New Node/listPokerMasterContent/main/view/content/item/main");//线路1
- if (pokerMasterGameLine1 && pokerMasterGameLine1.getComponent(cc.Button)) {
- // 模拟点击事件
- pokerMasterGameLine1.getComponent(cc.Button).clickEvents[0].emit([pokerMasterGameLine1]);
- } else {
- // console.error("节点未找到或节点上没有cc.Button组件");
- console.error("未找到扑克大师游戏游戏节点1");
- }
- //lws.send("存到本地");
- console.log("====>>>>远程脚本加载结束");
|