Files
2026-05-23 22:10:14 +08:00

167 lines
4.5 KiB
JavaScript

/*******************************************************************************
*
* 活动: 星空許願
*
*
******************************************************************************/
const ActBase = require( "act.base" );
const DailyChargeMod = require( "act.dailyfirstcharge.mod" );
const ActStarPray = cc.Class( {
extends: ActBase,
// 初始化配置数据
initConfig: function() {
// 视图附着
nx.plugin.add( this, [ "view" ] );
this.vattach( "Acts" );
},
// 注册协议接受事件
registerProtocals: function() {
this.RegisterProtocal( 31100, this.getStarPrayData.bind( this ) ); //今日充值次数
this.RegisterProtocal( 31101, this.getStarPrayBackData.bind( this ) ); //今日充值次数
this.RegisterProtocal( 31102, this.getStarPrayRewardData.bind( this ) ); //今日充值次数
this.RegisterProtocal( 31103, this.getStarPrayShopData.bind( this ) ); //今日充值次数
// // // 前端准备完毕
this.RegisterProtocal( 31105, this.getStarPrayJump.bind( this ) ); //今日充值次数
this.RegisterProtocal( 31106, this.getBuyDiaBack.bind( this ) ); //今日充值次数
this.RegisterProtocal( 31107, 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( 31100, {}, _cb );
// 請求 材料商店相關數據
},
// 獲取當前的 星空許願 數據
getStarPrayData: function( _data ){
let reward = 0;
if( _data ){
if( _data.free_end_time == 0 ){
reward ++;
}
}
this.openTip( "reward", reward > 0 );
//
this.vset( "starPrayData", _data );
},
// 獲取當前的 星空許願 數據
getStarPrayBackData: function( _data ){
//
// this.vset( "starPrayData", _data );
},
// 獲取當前的 星空許願直購 數據
getStarPrayShopData: function( _data ){
// {"code":1,"msg":"","day":1,"status":1}
this.vset( "starPrayShopData", _data );
},
// 領取當前的 星空許願獎勵
reqGetStarPrayRewardData: function( _data ){
let protocal = {};
protocal.group_id = _data.group_id;
protocal.type = _data.type;
protocal.id = _data.id;
this.SendProtocal( 31102, protocal );
},
// 領取當前的 星空許願獎勵
getStarPrayRewardData: function( _data ){
},
getBuyDiaBack: function( _data ){
},
// 請求 許願數據
reqGetStarPray: function( _data, _cb ){
let protocal = {};
protocal.group_id = _data.group_id;
protocal.times = _data.times;
this.SendProtocal( 31101, protocal, _cb );
},
// 请求当前直购商城信息
reqStarGiftInfo: function(){
let protocal = {};
this.SendProtocal( 31103, protocal );
},
// 領取當前的 星空許願獎勵
reqGetStarReachReward: function( _id ){
let protocal = {};
protocal.id = _id;
this.SendProtocal( 31104, protocal );
},
// 領取當前的 星空許願獎勵
reqSetStatus: function( _status, _cb ){
let protocal = {};
protocal.status = _status;
this.SendProtocal( 31105, protocal, _cb );
},
// 領取當前的 星空許願獎勵
reqBuyUseDia: function(){
let protocal = {};
this.SendProtocal( 31106, protocal );
},
// 请求当前祈祷记录
reqStarPrayRecord: function( _cb ){
let protocal = {};
this.SendProtocal( 31107, protocal, _cb );
},
getStarPrayJump : function( _data ){
},
// 領取當前的 星空許願獎勵
getStarPrayShopData: function( _data ){
this.vset( "starPrayShopData", _data );
},
getStarPrayRecords : function( _records ){
this.vset( "starPrayRecords", _records );
},
} );
// 模块导出
module.exports = ActStarPray;