我智商爆棚
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.
 
 
 
 
 

51 lines
1.4 KiB

// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import HeadIconScipt from "./HeadIconScipt";
import MoveTouchScript from "./MoveTouchScript";
const {ccclass, property} = cc._decorator;
@ccclass
export default class HeadNodeList extends cc.Component {
@property(cc.Node)
headNode: cc.Node = null;
@property(cc.Node)
headNodeContent: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
}
setHeadData(headListData, checkNodelist, targetList){
for(let i = 0;i<headListData.length;i++){
let data_ = headListData[i]
let headNode = cc.instantiate(this.headNode)
headNode.active = true
this.headNodeContent.addChild(headNode)
headNode.setPosition(cc.v2(0,0))
let scr:HeadIconScipt = headNode.getComponent('HeadIconScipt')
scr.setHeadIconData(data_)
let moveScr:MoveTouchScript = headNode.getChildByName('icon').getComponent('MoveTouchScript')
moveScr.setTouchNode(checkNodelist.children[i], targetList[i])
}
}
// update (dt) {}
}