149 lines
3.8 KiB
JavaScript
149 lines
3.8 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'ba7a0wc2xlJppFNVC38Vpak', 'cmp.act.fund');
|
||
|
|
// Scripts/mod/acts/fund/cmp.act.fund.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 成长基金
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var BasePage = require("act.page.base");
|
||
|
|
var NxExpand = require("nx.fx.sv.expand");
|
||
|
|
var NxSpine = require("nx.fx.spine");
|
||
|
|
var TipsController = require("tips_controller");
|
||
|
|
var PathTool = require("pathtool");
|
||
|
|
var Payment = require("payment.mod");
|
||
|
|
cc.Class({
|
||
|
|
"extends": BasePage,
|
||
|
|
properties: {
|
||
|
|
list: {
|
||
|
|
"default": null,
|
||
|
|
type: NxExpand
|
||
|
|
},
|
||
|
|
chargeNd: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
rebate: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
multi: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
roleSp: {
|
||
|
|
"default": null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
totalLock: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
btnBuy: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
claimTip: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 初始化
|
||
|
|
build: function build(_data) {
|
||
|
|
this._super(_data);
|
||
|
|
|
||
|
|
// 无效
|
||
|
|
if (!this.mod) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
this.charge_data = game.configs.charge_data.data_charge_data[101];
|
||
|
|
// 活动监听
|
||
|
|
this.mod.vbind(this, [["fundBaseData", this.freshInfos.bind(this)]]);
|
||
|
|
},
|
||
|
|
onEnable: function onEnable() {
|
||
|
|
var _this = this;
|
||
|
|
this.mod.reqFundData();
|
||
|
|
var res_path = PathTool.getSpinePath("H30036", "show", false);
|
||
|
|
this.roleSp.load(res_path, function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
_this.roleSp.action("action1", true);
|
||
|
|
} else {
|
||
|
|
_this.roleSp.stop();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
var price = Payment.getInstance().fmtPrice(this.charge_data.val);
|
||
|
|
nx.gui.setString(this.btnBuy, "txt", price);
|
||
|
|
},
|
||
|
|
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;
|
||
|
|
//是否购买
|
||
|
|
if (data.finish == 1) {
|
||
|
|
//已购买
|
||
|
|
this.totalLock.active = false;
|
||
|
|
nx.gui.setActive(this.btnBuy, "mask", true);
|
||
|
|
nx.gui.setString(this.btnBuy, "txt", nx.text.getKey("lab_rfm_personal_gift_window_tip2"));
|
||
|
|
}
|
||
|
|
this.buy_status = data.finish;
|
||
|
|
|
||
|
|
//收益列表
|
||
|
|
var list = [];
|
||
|
|
if (data.aim_list) {
|
||
|
|
list = data.aim_list;
|
||
|
|
}
|
||
|
|
this.list.rebuild(list);
|
||
|
|
|
||
|
|
//展示收益信息
|
||
|
|
this.setArgs(data.args);
|
||
|
|
nx.gui.setString(this.chargeNd, "val", this.charge_data.gold);
|
||
|
|
var res_path = PathTool.querySmallIconPath(3);
|
||
|
|
nx.gui.setSpriteFrame(this.chargeNd, "ico", res_path);
|
||
|
|
nx.gui.setActive(this.claimTip, "", this.mod.freshTips());
|
||
|
|
},
|
||
|
|
setArgs: function setArgs(args) {
|
||
|
|
if (nx.dt.arrEmpty(args)) return;
|
||
|
|
for (var i in args) {
|
||
|
|
if (args[i].args_key == 42) {
|
||
|
|
//充值返利倍率
|
||
|
|
nx.gui.setString(this.multi, "", args[i].args_str);
|
||
|
|
} else if (args[i].args_key == 31) {
|
||
|
|
//返利鑽石
|
||
|
|
nx.gui.setString(this.rebate, "lay/total", args[i].args_str);
|
||
|
|
var res_path = PathTool.querySmallIconPath(3);
|
||
|
|
nx.gui.setSpriteFrame(this.rebate, "lay/ico", res_path);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onClickRule: function onClickRule() {
|
||
|
|
var TC = TipsController.getInstance();
|
||
|
|
if (TC) {
|
||
|
|
var key = this.period % 2 == 0 ? "tips" : "tips_1";
|
||
|
|
var config = this.goals_data.data_constant[key];
|
||
|
|
TC.showTextPanel(null, config.desc);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onClickGetAward: function onClickGetAward() {
|
||
|
|
this.mod.reqGetFundAward(0);
|
||
|
|
},
|
||
|
|
onClickBuy: function onClickBuy() {
|
||
|
|
// //花钱买
|
||
|
|
// let msg = "pay " + this.charge_data.id;
|
||
|
|
Payment.getInstance().reqPayment(this.charge_data.id);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|