/******************************************************************************* * * 活动: 自選陣容 * * ******************************************************************************/ const ActBase = require( "act.base" ); const FID = require( "bridge.function.ids" ); const ActOptionalParty = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { this.RegisterProtocal( 16614, this.getOptionalPartyData.bind( this ) ); // 請求子活動相關,來取相關的顯示數據 this.RegisterProtocal( 16615, this.handle16604.bind( this ) ); // 請求領取子活動獎勵相關,來取相關的顯示數據 this.RegisterProtocal( 21003, this.handle21003.bind( this ) ); // 21003 isopen = 2 彈出對應的限時特惠禮包 }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ this.data.config,//付費活動 ] this.loadConfigs( cfgs, ( _ret, _data ) =>{ this.reqBaseData( _cb ); } ) }, // 请求活动信息 reqBaseData: function( _cb ) { this.reqOptionalPartyData( _cb ); }, // ============================================================ // 自選陣容 // ============================================================ // 请求 自選陣容信息 reqOptionalPartyData: function( _cb ) { this.SendProtocal( 16614, {}, _cb ); }, // 请求設置 自選陣容 夥伴--- camp_id reqSetOptionalParty: function( _camp, _partner_id, _cb ) { this.SendProtocal( 16615, { partner_ids : [ { id : _camp, partner_id : _partner_id } ] }, _cb ); }, // 请求領取 自選陣容 夥伴--- camp_id reqGetOptionalPartyAward: function( _camp ) { this.SendProtocal( 16616, { id : _camp, }); }, // 陣容信息 返回 getOptionalPartyData: function( _data ) { this.vset( "optionalparty", _data ); let num = 0; _data.partner_ids.forEach( _partner => { if( _partner.status == 1 ){ num++; } }); this.openTip( "reward", num > 0 || ( _data.remain_sec > 0 && nx.dt.arrEmpty( _data.partner_ids ) ) ); }, // 请求相關配置信息 handle16604: function( _data ) { }, handle21003( _data ){ if( !_data || nx.dt.objEmpty( _data ) || !nx.bridge.acts ) { return; } if( _data.is_open == 3 ){ let actinfo = nx.bridge.acts.queryAct( this.data.camp_id ); if( nx.dt.objEmpty( actinfo ) ){ return; } nx.bridge.vset( "DailyLimit", _data.is_open ); // nx.bridge.createPanel( "WndActMySteryShop" ); } }, } ); // 模块导出 module.exports = ActOptionalParty;