131 lines
3.2 KiB
JavaScript
131 lines
3.2 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '6ca603i3pdOybkTFLlmMysz', 'cmp.act.summon.limit.shop');
|
|
// Scripts/mod/acts/summonLimit/cmp/cmp.act.summon.limit.shop.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
*
|
|
* 限定招募商城
|
|
*
|
|
******************************************************************/
|
|
|
|
var ActPage = require("act.page.base");
|
|
var TipsController = require("tips_controller");
|
|
cc.Class({
|
|
"extends": ActPage,
|
|
properties: {
|
|
nodHead: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
lstProd: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodDate: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 初始化
|
|
build: function build(_data) {
|
|
this._super(_data);
|
|
|
|
// 置空
|
|
if (!this.mod || nx.dt.objEmpty(this.data)) {
|
|
this.setEmpty();
|
|
return;
|
|
}
|
|
|
|
// 配置查询
|
|
this.configs = this.mod.queryConfigs();
|
|
if (!this.configs) {
|
|
nx.error("$SummonLimitShop:\u914D\u7F6E\u7F3A\u5931! " + this.data.camp_id);
|
|
this.setEmpty();
|
|
return;
|
|
}
|
|
|
|
// 基本信息
|
|
this.freshBasic();
|
|
},
|
|
// 显示
|
|
onEnable: function onEnable() {
|
|
var _this = this;
|
|
if (!this.mod) {
|
|
return;
|
|
}
|
|
this.mod.reqBaseData(function (_ret, _data) {
|
|
if (_ret) {
|
|
_this.freshDate(_data.remain_sec);
|
|
_this.freshProducts(_data.aim_list);
|
|
}
|
|
});
|
|
},
|
|
// 置空
|
|
setEmpty: function setEmpty() {
|
|
nx.gui.setActive(this, "right", false);
|
|
},
|
|
// 基本信息
|
|
freshBasic: function freshBasic() {
|
|
// 置空
|
|
if (!this.mod || !this.configs || nx.dt.objEmpty(this.data)) {
|
|
this.setEmpty();
|
|
return;
|
|
}
|
|
nx.gui.setActive(this, "right", true);
|
|
|
|
// 背景刷新
|
|
var bg = cc.path.join("resDB/bigs", this.configs.bg || "bg005");
|
|
nx.gui.setSpriteFrame(this, "bg", bg);
|
|
|
|
// 商店头部
|
|
var head = cc.path.join("locals/{lang}/images/limitrecruit", this.configs.title);
|
|
nx.gui.setSpriteFrame(this.nodHead, "", nx.res.fmtPath(head));
|
|
},
|
|
// 刷新活动日期
|
|
freshDate: function freshDate(_secs) {
|
|
var time = nx.bridge.time.toNeedSeconds(_secs);
|
|
nx.gui.setString(this.nodDate, "txt", time);
|
|
},
|
|
// 商品刷新
|
|
freshProducts: function freshProducts(_lst) {
|
|
// 空
|
|
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.payment.item");
|
|
cmp.setData(_lst[i]);
|
|
}
|
|
},
|
|
// 商品事件
|
|
onProductEvent: function onProductEvent(_data) {
|
|
if (!this.mod || !_data || _data.diamond != true) {
|
|
return;
|
|
}
|
|
|
|
// 钻石类购买
|
|
this.mod.reqBuyDiamondProdcut(function (_ret) {
|
|
if (_ret) {
|
|
nx.dt.fnInvoke(_data.cb, true);
|
|
}
|
|
});
|
|
},
|
|
// 点击规则
|
|
onTouchRule: function onTouchRule() {
|
|
var rule = this.mod ? this.mod.queryRule() : "";
|
|
if (nx.dt.strNEmpty(rule)) {
|
|
var TC = TipsController.getInstance();
|
|
TC.showTextPanel("tip", rule);
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |