/******************************************************************************* * * 活动: 每日活跃 * * ******************************************************************************/ const ActBase = require( "act.base" ); const ActDailyTreasure = cc.Class( { extends: ActBase, // 初始化配置数据 initConfig: function() { // 视图附着 nx.plugin.add( this, [ "view" ] ); this.vattach( "Acts" ); }, // 注册协议接受事件 registerProtocals: function() { this.RegisterProtocal( 31120, this.getDailyTreasureData.bind( this ) ); // 當前活躍活動任務相關 this.RegisterProtocal( 31121, this.freshTreasureTaskR.bind( this ) ); // 當前活躍活動任務相關 this.RegisterProtocal( 31122, this.getTreasureTaskR.bind( this ) ); // 當前活躍活動任務相關 this.RegisterProtocal( 31123, this.getStarPrayData.bind( this ) ); // 活躍度抽獎相關 this.RegisterProtocal( 31124, this.getStarPrayBackData.bind( this ) ); // 請求轉盤獎勵 this.RegisterProtocal( 31125, this.getStarPrayRewardData.bind( this ) ); // 領取轉盤獎勵 this.RegisterProtocal( 31126, this.getDailyReachData.bind( this ) ); // 領取轉盤活躍達成獎勵 // // // // 前端准备完毕 this.RegisterProtocal( 31127, this.getStarPrayJump.bind( this ) ); // 跳過 返回 // this.RegisterProtocal( 31106, this.getBuyDiaBack.bind( this ) ); // 今日充值次数 this.RegisterProtocal( 31128, this.getStarPrayRecords.bind( this ) ); // 活躍度 獎勵記錄 // this.RegisterProtocal(14100, this.GetSignStatus.bind( this ) ); // this.RegisterProtocal(14101, this.GetSignBack.bind( this ) ); }, // 从服务器初始化数据 reqBaseFromServer: function( _cb ) { let cfgs = [ this.data.config,//付費活動 ] this.loadConfigs( cfgs, ( _ret, _data ) =>{ this.reqBaseData( _cb ); // nx.dt.fnInvoke( _cb, true ); } ) }, // 请求剧情信息 reqBaseData: function( _cb ) { this.SendProtocal( 31123, {}, _cb ); // 請求 材料商店相關數據 this.reqDailyTask(); }, reqBaseInfo: function(){ this.SendProtocal( 31123, {} ); }, // 獲取當前的 星空許願 數據 getStarPrayData: function( _data ){ // this.vset( "dailyStarPrayData", _data ); }, // 獲取當前的 星空許願 數據 getStarPrayBackData: function( _data ){ // // this.vset( "starPrayData", _data ); }, // 領取當前的 星空許願獎勵 reqGetStarPrayRewardData: function( _data ){ let protocal = {}; protocal.group_id = _data.group_id; protocal.type = _data.type; protocal.id = _data.id; this.SendProtocal( 31125, protocal ); }, // 領取當前的 星空許願獎勵 getStarPrayRewardData: function( _data ){ }, getBuyDiaBack: function( _data ){ }, freshTreasureTaskR: function( _data ){ this.vset( "freshDailyTask", _data ); this.dealTip( _data ); }, dealTip: function( _data ){ let list = _data.list; let show = 0; if( nx.dt.arrNEmpty( list ) ){ list.forEach( _item =>{ if( _item.finish == 1 ){ show++; } } ) } this.openTip( "reward", show > 0 ); }, // [31121]:{"list":[{"id":60005,"type":13,"finish":2,"target_val":1,"value":1,"end_time":0}]} // 請求 許願數據 reqGetStarPray: function( _data, _cb ){ let protocal = {}; protocal.group_id = _data.group_id; protocal.times = _data.times; this.SendProtocal( 31124, protocal, _cb ); }, // 请求当前直购商城信息 reqStarGiftInfo: function(){ let protocal = {}; this.SendProtocal( 31103, protocal ); }, // 領取當前的 星空許願獎勵 reqGetStarReachReward: function( _id ){ let protocal = {}; protocal.id = _id; this.SendProtocal( 31126, protocal ); }, getDailyReachData: function( _data ){ }, // 領取當前的 星空許願獎勵 reqSetStatus: function( _status, _cb ){ let protocal = {}; protocal.status = _status; this.SendProtocal( 31127, protocal, _cb ); }, // 領取當前的 星空許願獎勵 reqBuyUseDia: function(){ let protocal = {}; this.SendProtocal( 31106, protocal ); }, // 请求当前祈祷记录 reqStarPrayRecord: function( _cb ){ let protocal = {}; this.SendProtocal( 31128, protocal, _cb ); }, // 请求当前每日任务 reqDailyTask: function( _cb ){ let protocal = {}; this.SendProtocal( 31120, protocal, _cb ); }, getDailyTreasureData: function( _data ){ this.vset( "dailySPrayTask", _data ); this.dealTip( _data ); }, reqTreasureTaskR : function( _id ){ let protocal = {}; protocal.id = _id; this.SendProtocal( 31122, protocal ); }, getTreasureTaskR : function( _data ){ }, getStarPrayJump : function( _data ){ }, getStarPrayRecords : function( _records ){ // this.vset( "dailySPrayRecords", _records ); }, } ); // 模块导出 module.exports = ActDailyTreasure;