/****************************************************************** * * 成长基金 * ******************************************************************/ const BasePage = require( "act.page.base" ); const NxExpand = require("nx.fx.sv.expand"); const NxSpine = require("nx.fx.spine"); const TipsController = require("tips_controller"); const PathTool = require("pathtool"); const 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( _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(){ this.mod.reqFundData(); let res_path = PathTool.getSpinePath( "H30036","show", false ); this.roleSp.load( res_path, ( _e ) => { if( !_e ) { this.roleSp.action( "action1", true ); } else { this.roleSp.stop(); } } ); let price = Payment.getInstance().fmtPrice(this.charge_data.val); nx.gui.setString(this.btnBuy,"txt",price); }, onDisable(){ this.list.rebuild([]); }, // 销毁 onDestroy: function() { // 活动监听解除 if( this.mod ) { this.mod.vunbind( this ); } this._super(); }, 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; //收益列表 let 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); let res_path = PathTool.querySmallIconPath(3); nx.gui.setSpriteFrame(this.chargeNd,"ico",res_path); nx.gui.setActive(this.claimTip,"",this.mod.freshTips()); }, setArgs(args){ if(nx.dt.arrEmpty(args))return; for(let 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); let res_path = PathTool.querySmallIconPath(3); nx.gui.setSpriteFrame(this.rebate,"lay/ico",res_path); } } }, onClickRule(){ let TC = TipsController.getInstance(); if( TC ) { let key = (this.period%2 == 0)?"tips":"tips_1"; let config = this.goals_data.data_constant[key]; TC.showTextPanel(null,config.desc ); } }, onClickGetAward(){ this.mod.reqGetFundAward(0); }, onClickBuy(){ // //花钱买 // let msg = "pay " + this.charge_data.id; Payment.getInstance().reqPayment( this.charge_data.id ); } } );