87 lines
1.8 KiB
JavaScript
87 lines
1.8 KiB
JavaScript
|
|
/*******************************************************************************
|
||
|
|
*
|
||
|
|
* 活动: 新服專享
|
||
|
|
*
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
const ActBase = require( "act.base" );
|
||
|
|
|
||
|
|
const ActExclusive = 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 ) ); //
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 从服务器初始化数据
|
||
|
|
reqBaseFromServer: function( _cb ) {
|
||
|
|
|
||
|
|
// nx.dt.fnInvoke( _cb, true );
|
||
|
|
this.reqBaseData( _cb );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 请求活动信息
|
||
|
|
reqBaseData: function( _cb ) {
|
||
|
|
this.reqExclusiveData( _cb );
|
||
|
|
},
|
||
|
|
|
||
|
|
// ============================================================
|
||
|
|
// 操作
|
||
|
|
// ============================================================
|
||
|
|
|
||
|
|
// 请求新服专享信息
|
||
|
|
reqExclusiveData: function( _cb ) {
|
||
|
|
|
||
|
|
this.SendProtocal( 16603, {
|
||
|
|
bid : this.data.camp_id,
|
||
|
|
}, _cb );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 领取新服专享礼包
|
||
|
|
reqExclusiveGift: function( aim ) {
|
||
|
|
this.SendProtocal( 16604, {
|
||
|
|
bid: this.data.camp_id,
|
||
|
|
aim: aim,
|
||
|
|
arg: 0
|
||
|
|
} );
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
// 请求相關配置信息
|
||
|
|
handle16603: function( _data ) {
|
||
|
|
|
||
|
|
if( _data.bid == this.data.camp_id ){
|
||
|
|
this.vset( "exclusive", _data );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
handle16604: function( _data ){
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
} );
|
||
|
|
|
||
|
|
// 模块导出
|
||
|
|
module.exports = ActExclusive;
|