/******************************************************************************* * * 活动: 升星有禮活動 * * ******************************************************************************/ const ActBase = require( "act.base" ); const SevenGoal = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { this.RegisterProtocal(13604, this.handle13604); // 任务信息 this.RegisterProtocal(13605, this.handle13605); // 任务信息更新 this.RegisterProtocal(13606, this.handle13606); // 提交任务 this.RegisterProtocal(13607, this.handle13607); // 等级奖励展示 this.RegisterProtocal(13608, this.handle13608); // 领取等级礼包,推送13607 this.RegisterProtocal(13609, this.handle13609); // 等级变更,服务端主动推 }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ this.data.config, ] this.loadConfigs( cfgs, ( _ret, _data ) =>{ this.reqBaseData(_cb); } ) }, // 请求剧情信息 reqBaseData: function( _cb ) { this.reqSevenData(_cb); }, reqSevenData( _cb ){ this.send13604(_cb); }, // ============================================================ // 周期七日目标操作 // ============================================================ //任務信息 send13604(_cb){ this.SendProtocal(13604, {},_cb) }, handle13604: function( _data ) { if( !this.isGoodData( _data ) ) { this.vset("sevenGoalData",{}); return; } this.setLev(_data.lev); this.setExp(_data.exp); this.setEndTime(_data.end_time); this.vset("sevenGoalData",_data); // 提示刷新 this.freshTips(); }, handle13605: function( _data ) { if( !this.isGoodData( _data ) ) { return; } let base_data = this.vget("sevenGoalData"); //检查任务完成度 let list = base_data.list; for(let i=0;i