/******************************************************************************* * * 活动: 超值自選礼包 --- 破冰 * * ******************************************************************************/ const ActBase = require( "act.base" ); const ActOptionalGift = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { this.RegisterProtocal( 21051, this.getOptionalGift.bind( this ) ); // 請求子活動相關,來取相關的顯示數據 this.RegisterProtocal( 21052, this.getOptionalGiftSelect.bind( this ) ); // 請求領取子活動獎勵相關,來取相關的顯示數據 }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ this.data.config,//付費活動 ] this.loadConfigs( cfgs, ( _ret, _data ) =>{ this.reqBaseData( _cb ); } ) }, // 请求活动信息 reqBaseData: function( _cb ) { this.reqOptionalGift( _cb ); }, // ============================================================ // 自選陣容 // ============================================================ // 请求 自選陣容信息 reqOptionalGift: function( _cb ) { this.SendProtocal( 21051, {}, _cb ); }, // 请求設置 自選陣容 夥伴--- camp_id getOptionalGift: function( _data ) { this.vset( "optionalGift", _data ); }, // 请求 選擇超值自選 道具 reqOptionalSelect: function( _id, _list ) { let data = { id : _id, item_list : _list } this.SendProtocal( 21052, data ); }, // 選擇超值自選 返回 getOptionalGiftSelect: function( _data ) { this.vset( "optionalGiftSaveBack", _data.code ); if( nx.dt.strNEmpty( _data.msg ) ){ nx.tbox( _data.msg ); } }, } ); // 模块导出 module.exports = ActOptionalGift;