pubgv3/assets/scripts/UI/hero/cellherobag.js
zhuguoqing 53febf2dc4 update
2022-05-28 10:31:45 +08:00

54 lines
1.6 KiB
JavaScript

// Learn cc.Class:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
// - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
// - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
let viewCell = require('viewCell');
cc.Class({
extends: viewCell,
properties: {
nd_1: {
default: null,
type: cc.Node,
},
nd_2: {
default: null,
type: cc.Node,
},
nd_3: {
default: null,
type: cc.Node,
},
nd_4: {
default: null,
type: cc.Node,
},
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
init: function (index, data, reload, group) {
if (index >= data.array.length) {
this.node.active = false;
return;
}
this.target = data.target;
var sdata = data.array[index];
this.nd_1.getComponent('herochoseone').initdata(sdata[0]);
this.nd_2.getComponent('herochoseone').initdata(sdata[1]);
this.nd_3.getComponent('herochoseone').initdata(sdata[2]);
this.nd_4.getComponent('herochoseone').initdata(sdata[3]);
},
// update (dt) {},
});