92 lines
2.4 KiB
JavaScript
92 lines
2.4 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '2a3ddFbx9lJV55VJRyLyyu5', 'cmp.payment.recharge.item');
|
|
// Scripts/mod/payment/cmp/cmp.payment.recharge.item.js
|
|
|
|
"use strict";
|
|
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
|
var Payment = require("payment.mod");
|
|
cc.Class({
|
|
"extends": SVCItem,
|
|
properties: {
|
|
nodFirstIco: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodFirst: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodIcon: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodExt: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodDesc: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodPrice: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 数据重置
|
|
rebind: function rebind(_idx, _data, _key) {
|
|
this._super(_idx, _data, _key);
|
|
if (!this.mdata) {
|
|
return;
|
|
}
|
|
nx.gui.setActive(this.nodFirst, "", false);
|
|
this.freshInfo();
|
|
},
|
|
// 刷新具体信息
|
|
freshInfo: function freshInfo() {
|
|
var payinfo = game.configs.charge_data.data_charge_data[this.mdata.id];
|
|
// 图标
|
|
var path = cc.path.join("prefab/payment/ui", this.mdata.pic);
|
|
nx.gui.setSpriteFrame(this.nodIcon, "", path);
|
|
|
|
// 首充
|
|
|
|
nx.gui.setActive(this.nodFirstIco, "", this.mdata.is_first == 1);
|
|
nx.gui.setActive(this, "first", true);
|
|
if (this.mdata.is_first == 1) {
|
|
nx.gui.setString(this, "first/txt", nx.text.getKey("BuyOnce"));
|
|
} else {
|
|
if (this.mdata.add_gold > 0) {
|
|
nx.gui.setString(this, "first/txt", nx.text.getKey("+20%"));
|
|
}
|
|
}
|
|
|
|
// 贈送
|
|
if (this.mdata.add_gold > 0) {
|
|
var txt = "";
|
|
nx.gui.setActive(this.nodExt, "", true);
|
|
if (this.mdata.is_first == 1) {
|
|
txt = nx.text.format("BuyBaseGetc", this.mdata.get_gold, payinfo.first_add);
|
|
} else {
|
|
txt = nx.text.format("BuyBaseGetc", this.mdata.get_gold, payinfo.add);
|
|
// txt = nx.text.getKey( "BuyBaseGetc" ) + this.mdata.add_gold ;
|
|
}
|
|
|
|
nx.gui.setString(this.nodDesc, "", txt);
|
|
} else {
|
|
var _txt = nx.text.format("BuyBaseGet", this.mdata.get_gold);
|
|
nx.gui.setString(this.nodDesc, "", _txt);
|
|
// nx.gui.setActive( this.nodExt, "", false );
|
|
}
|
|
|
|
// 基础获得
|
|
var real = nx.text.format("BuyDescTip", this.mdata.get_gold);
|
|
nx.gui.setString(this.nodExt, "", real);
|
|
|
|
// 价格(暂无转换)
|
|
nx.gui.setString(this.nodPrice, "", Payment.getInstance().fmtPrice(this.mdata.need_rmb));
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |