"use strict"; cc._RF.push(module, '8eae0LGL1VNnL4O6T4rEz2e', 'cmp.act.elite.gift.wnd'); // Scripts/mod/acts/elite/cmps/cmp.act.elite.gift.wnd.js "use strict"; /****************************************************************** * * 精英召唤助力禮包 * ******************************************************************/ var ActPage = require("act.page.base"); var EliteShop = require("act.elite.shop.mod"); cc.Class({ "extends": ActPage, properties: { lstProd: { "default": null, type: cc.Node }, nodDate: { "default": null, type: cc.Node } }, // 初始化 build: function build(_data) { this._super(_data); var model = EliteShop.getInstance(); if (!model) { this.delayClose(); return; } // 视图监听 model.vbind(this, [["eliteGifts", this.onGiftsFresh.bind(this)]]); nx.gui.setActive(this.nodDate, "", false); model.reqGiftList(); }, // 关闭 onDestroy: function onDestroy() { // 视图监听 var model = EliteShop.getInstance(); if (model) { model.vunbind(this); } }, // 礼包刷新 onGiftsFresh: function onGiftsFresh(_lst, _old, _init) { if (_init) return; // 空 if (nx.dt.arrEmpty(_lst)) { nx.gui.setActive(this.lstProd, "", false); return; } // 重建 nx.gui.setActive(this.lstProd, "", true); var root = nx.gui.find(this.lstProd, "view/content"); nx.gui.gocChildren(root, "", _lst.length, root.children[0]); for (var i = 0; i < _lst.length; ++i) { var cmp = nx.gui.getComponent(root.children[i], "", "cmp.act.elite.gift.item"); cmp.setData(_lst[i]); } } }); cc._RF.pop();