/******************************************************************************* * * 活动: 限定招募&&商城 * * ******************************************************************************/ const ActBase = require( "act.base" ); const ActBuyLimit = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { this.RegisterProtocal( 16603, this.handle16603.bind( this ) ); // 請求子活動相關,來取相關的顯示數據 }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ "activity_set_quota_data", ] //所有限購類型提前push let _data = this.vget("buyLimitInfos"); _data[this.data.camp_id] = {}; this.vset("buyLimitInfos",_data); this.loadConfigs( cfgs, ( _ret, _data ) =>{ // this.reqBaseData(_cb); nx.dt.fnInvoke( _cb, true ); } ) }, // 请求剧情信息 reqBaseData: function( _cb ) { nx.dt.fnInvoke( _cb, true ); }, // ============================================================ // 限購消息 // ============================================================ // 请求信息 reqLimitData: function(_camp_id, _cb ) { this.SendProtocal( 16603, { bid : _camp_id, }, _cb ); }, // 请求相關配置信息 handle16603: function( _data ) { if( !this.isGoodData( _data ) ) { return; } if(this.data.theme_id == _data.cli_type){ let old_data = this.vget("buyLimitInfos"); old_data[_data.bid] = _data; this.vset( "buyLimitCamp", _data.bid ); this.vset( "buyLimitInfos", old_data ); } } } ); // 模块导出 module.exports = ActBuyLimit;