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

116 lines
3.3 KiB
JavaScript

/*******************************************************************************
*
* 活动: 月签到
*
*
******************************************************************************/
const ActBase = require( "act.base" );
const DailyChargeMod = require( "act.dailyfirstcharge.mod" );
const ActPowerAim = cc.Class( {
extends: ActBase,
// 初始化配置数据
initConfig: function() {
// 视图附着
nx.plugin.add( this, [ "view" ] );
this.vattach( "Acts" );
},
// 注册协议接受事件
registerProtocals: function() {
this.RegisterProtocal( 23400, this.handle23400.bind( this ) ); //今日充值次数
this.RegisterProtocal( 23403, this.handle23403.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 ) =>{
nx.dt.fnInvoke( _cb, true );
this.reqBaseData();
} )
},
// 请求剧情信息
reqBaseData: function( _cb ) {
this.SendProtocal( 23400, {}, _cb );
},
handle23400 : function( _data ){
let len = gdata( this.data.config, "data_get_info_length" );
let datas = [];
let count = 0;
if( _data ){
if( nx.dt.arrNEmpty( _data.power_gift_list ) ){
let list = _data.power_gift_list;
for (let i = 0; i < len; i++) {
let gift = list[i];
if( gift ){
if( gift.id == i + 1 ){
gift.sortid = 2;
switch( gift.status ){
case 1:{ gift.sortid = 1; count ++ ; };break;
case 2:{ gift.sortid = 3; };break;
}
datas.push( gift );
}
}else{
let giftc = {
id : i + 1,
status : 0,
sortid : 2,
}
datas.push( giftc );
}
}
// _data.power_gift_list.sort( ( a, b )=>{
// return a.status - b.status;
// } )
}else{
for (let i = 0; i < len; i++) {
let giftc = {
id : i + 1,
status : 0,
sortid : 2,
}
datas.push( giftc );
}
}
}
_data.power_gift_list = datas;
this.vset( "ActsPowerAimProve", _data );
this.openTip( "reward", count > 0 );
},
// 请求剧情信息
reqGet: function( _id ) {
let data = {
id : _id
}
this.SendProtocal( 23403, data );
},
handle23403 : function( _data ){
},
} );
// 模块导出
module.exports = ActPowerAim;