Files
fc/dev/project/assets/Scripts/mod/payment/cmp/cmp.payment.recharge.item.js
2026-05-23 22:10:14 +08:00

79 lines
2.5 KiB
JavaScript

const SVCItem = require("nx.fx.sv.expand.item");
const 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 (_idx, _data, _key) {
this._super(_idx, _data, _key);
if( !this.mdata ){
return;
}
nx.gui.setActive( this.nodFirst, "", false );
this.freshInfo();
},
// 刷新具体信息
freshInfo:function(){
let payinfo = game.configs.charge_data.data_charge_data[this.mdata.id];
// 图标
let 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 ) {
let 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 {
let txt = nx.text.format( "BuyBaseGet", this.mdata.get_gold );
nx.gui.setString( this.nodDesc, "", txt );
// nx.gui.setActive( this.nodExt, "", false );
}
// 基础获得
let 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 ) );
},
});