1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- const GameModule = require('../utils/GameModule');
- cc.Class({
- extends: cc.Component,
- properties: {
- scrollViewNode: cc.Node,
- giftLayout: cc.Layout,
- giftItem: cc.Prefab,
- emptyLabel: cc.Label
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- },
- init(array) {
- this.array = array;
- if (array.length > 0) {
- this.scrollViewNode.active = true;
- this.emptyLabel.node.active = false;
- for (let i = 0; i < array.length; ++i) {
- let gift = array[i];
- let item = cc.instantiate(this.giftItem);
- item = item.getComponent('StarGiftBagItem');
- item.configData(gift);
- this.giftLayout.node.addChild(item.node);
- }
- } else {
- this.scrollViewNode.active = false;
- this.emptyLabel.node.active = true;
- }
- },
- closeNode() {
- GameModule.audioMng.playClickButton();
- this.node.destroy();
- }
- // update (dt) {},
- });
|