/******************************************************************************* * * 活动: 中心城保衛戰 * * ******************************************************************************/ const ActBase = require( "act.base" ); const PlaneAct = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { this.RegisterProtocal( 16603, this.handle16603.bind( this ) ); // 請求子活動相關,來取相關的顯示數據 this.RegisterProtocal( 16604, this.handle16604.bind( this ) ); // 請求領取子活動獎勵相關,來取相關的顯示數據 this.RegisterProtocal( 16612, this.handle16612.bind( this ) ); // 請求領取子活動獎勵相關,來取相關的顯示數據 this.RegisterProtocal( 16613, this.handle16613.bind( this ) ); // 請求領取子活動獎勵相關,來取相關的顯示數據 }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ this.data.config,//付費活動 ] this.loadConfigs( cfgs, ( _ret, _data ) =>{ this.reqBaseData( _cb ); this.reqGetActivePoints(); // nx.dt.fnInvoke( _cb, true ); } ) }, // 请求活动信息 reqBaseData: function( _cb ) { this.reqPlaneActData( _cb ); }, // ============================================================ // 中心城 // ============================================================ // 请求点金 信息 reqPlaneActData: function( _cb ) { this.SendProtocal( 16603, { bid : this.data.camp_id, }, _cb ); }, // 请求領取快速作戰獎勵 reqGetPlaneActGift: function( _aim ) { this.SendProtocal( 16604, { bid : this.data.camp_id, aim : _aim, arg : 0 }); }, // 请求相關配置信息 handle16603: function( _data ) { if( _data.bid == this.data.camp_id ){ _data.aim_list.sort( ( a ,b ) => { return a.aim - b.aim; } ) _data.aim_list.forEach( _aim => { _aim.sortid = _aim.status == 1 ? _aim.status - 1 : _aim.status + 1; } ) this.vset( "planeact", _data ); } }, // 请求相關配置信息 handle16604: function( _data ) { }, // 请求活動 活躍積分 reqGetActivePoints: function( ) { this.SendProtocal( 16612, {}); }, // 请求活動活躍積分 handle16612: function( _data ) { this.vset( "activepoints", _data ); }, // 请求活動 活躍積分寶箱 reqGetActiveReward: function( _id ) { this.SendProtocal( 16613, { id: _id }); }, // 请求領取活動活躍 獎勵 handle16613: function( _data ) { }, } ); // 模块导出 module.exports = PlaneAct;