95 lines
2.3 KiB
JavaScript
95 lines
2.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'a68169T+6pBWZrRHH40JoAx', 'cmp.act.luxury');
|
|
// Scripts/mod/acts/luxury/cmp.act.luxury.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
*
|
|
* 積天好禮
|
|
*
|
|
******************************************************************/
|
|
|
|
var BasePage = require("act.page.base");
|
|
var NxExpand = require("nx.fx.sv.expand");
|
|
var FxSpine = require("nx.fx.spine");
|
|
var PathTool = require("pathtool");
|
|
var Payment = require("payment.mod");
|
|
cc.Class({
|
|
"extends": BasePage,
|
|
properties: {
|
|
list: {
|
|
"default": null,
|
|
type: NxExpand
|
|
},
|
|
roleSp: {
|
|
"default": null,
|
|
type: FxSpine
|
|
},
|
|
price: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
tips: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
statusLb: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 初始化
|
|
build: function build(_data) {
|
|
this._super(_data);
|
|
|
|
// 无效
|
|
if (!this.mod) {
|
|
return;
|
|
}
|
|
|
|
// 活动监听
|
|
this.mod.vbind(this, [["luxuryBaseData", this.freshInfos.bind(this)]]);
|
|
},
|
|
onEnable: function onEnable() {
|
|
var _this = this;
|
|
this.mod.reqLuxuryData();
|
|
var res_path = PathTool.getSpinePath("H30106", "show", false);
|
|
this.roleSp.load(res_path, function (_e) {
|
|
if (!_e) {
|
|
_this.roleSp.action("action1", true);
|
|
} else {
|
|
_this.roleSp.stop();
|
|
}
|
|
});
|
|
var val = Payment.getInstance().fmtPrice(7);
|
|
nx.gui.setString(this.price, "", val);
|
|
},
|
|
onDisable: function onDisable() {
|
|
this.list.rebuild([]);
|
|
},
|
|
// 销毁
|
|
onDestroy: function onDestroy() {
|
|
// 活动监听解除
|
|
if (this.mod) {
|
|
this.mod.vunbind(this);
|
|
}
|
|
this._super();
|
|
},
|
|
freshInfos: function freshInfos(data) {
|
|
if (nx.dt.objEmpty(data)) return;
|
|
nx.gui.setString(this.tips, "", cc.js.formatStr(nx.text.getKey("BuyDayCharges"), this.mod.getActDay()));
|
|
this.list.rebuild(data.aim_list);
|
|
var is_finish = false;
|
|
for (var i in data.aim_list) {
|
|
if (data.aim_list[i].aim == this.mod.getActDay()) {
|
|
is_finish = data.aim_list[i].status != 0;
|
|
break;
|
|
}
|
|
}
|
|
var str = is_finish ? nx.text.getKey("BuyDayNoFinish") : nx.text.getKey("BuyDayFinish");
|
|
nx.gui.setString(this.statusLb, "", str);
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |