Files
fc/dev/project/assets/Scripts/mod/acts/assembly/act.assembly.mod.js
T
2026-05-23 22:10:14 +08:00

99 lines
2.4 KiB
JavaScript

/*******************************************************************************
*
* 活动: 開服活動 集結令
*
*
******************************************************************************/
const ActBase = require( "act.base" );
const AssemblyMod = cc.Class( {
extends: ActBase,
// 初始化配置数据
initConfig: function() {
// 视图附着
nx.plugin.add( this, [ "view" ] );
this.vattach( "Acts" );
},
// 注册协议接受事件
registerProtocals: function() {
// // 前端准备完毕
this.RegisterProtocal( 16653, this.GetAssemblyInfo.bind( this ) );
this.RegisterProtocal( 16654, this.GetAssemblyRewardBack.bind( this ) );
},
// 从服务器初始化数据
reqBaseFromServer: function( _cb ) {
let cfgs = [
"charge_data",//付費活動
]
this.loadConfigs( cfgs, ( _ret, _data ) =>{
nx.dt.fnInvoke( _cb, true );
this.reqAssemblyData( );
} )
},
// 请求每日首次充值數據
reqAssemblyData: function( _cb ) {
this.SendProtocal( 16653, {}, _cb );
},
GetAssemblyInfo: function( _data ){
let count = 0;
let show = 0;
_data.award_list.forEach( _award =>{
if( _award.finish == 1 ){
count ++;
}
if( _award.id == 0 && ( _award.finish == 1 || _award.finish == 0 ) ){
show ++;
}
} )
if( count == 0 ){
// this.openTip( "reward", false );
this.openTip( "reward", show > 0 );
}
_data.award_list.sort( ( a,b ) => {
return a.id - b.id;
} )
this.vset( "assembly", _data );
},
reqGetAssemblyAward: function( _id ) {
this.SendProtocal( 16654, {
id : _id
} );
},
GetAssemblyRewardBack: function( _data ){
// {"code":1,"msg":"","day":1,"status":1}
if( _data.code == 1 ){
// let data = nx.bridge.acts.vget( "sign30" );
// data.day = _data.day;
// data.status = _data.status;
// nx.bridge.acts.vset( "sign30", data );
}
// this.reqBaseData();
},
GetAssemblyFreeBack : function( _data ){
},
} );
// 模块导出
module.exports = AssemblyMod;