消除我特牛
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
xiaochuwoteniu/assets/WordGame/gameComScript/ZhuangbanIconList.ts

55 lines
1.8 KiB

import ZhuangBanMoveTouchScript from "./touch/ZhuangBanMoveTouchScript";
const { ccclass, property } = cc._decorator;
@ccclass
export default class ZhuangbanIconList extends cc.Component {
@property(cc.Node)
zhuangbanNode: cc.Node = null;
@property(cc.Node)
content: cc.Node = null;
start() {
this.zhuangbanNode.active = false;
}
setChaDianData(ZhuangbanIconList: string[][], checkNodeList: cc.Node, targetNodeList: cc.Node[][]) {
let zhuangbanData = [];
for (let arr = 0; arr < ZhuangbanIconList.length; arr++) {
let checkNodes = checkNodeList.children[arr];
let targetNodes = targetNodeList[arr];
let zhuangbans = ZhuangbanIconList[arr];
for (let index = 0; index < ZhuangbanIconList[arr].length; index++) {
let data_ = {
npcIndex: arr,
zhuangbanIndex: index,
picPath: zhuangbans[index],
checkNode: checkNodes.children[index],
targetNode: targetNodes[index]
};
zhuangbanData.push(data_);
}
}
for (let index = 0; index < zhuangbanData.length; index++) {
let aInt = Math.trunc(Math.random() * zhuangbanData.length);
let random = zhuangbanData[aInt];
zhuangbanData[aInt] = zhuangbanData[index];
zhuangbanData[index] = random;
}
for (let i = 0; i < zhuangbanData.length; i++) {
let zhuangbanNode = cc.instantiate(this.zhuangbanNode);
zhuangbanNode.active = true;
this.content.addChild(zhuangbanNode);
let scr: ZhuangBanMoveTouchScript = zhuangbanNode.getComponent('ZhuangBanMoveTouchScript')
scr.setTouchNode(zhuangbanData[i]);
}
}
// update (dt) {}
}