Files

122 lines
3.1 KiB
JavaScript
Raw Permalink Normal View History

2026-05-23 22:10:14 +08:00
/*******************************************************************************
*
* 活动: 八日签到
*
*
******************************************************************************/
const ActBase = require( "act.base" );
const ActDay8 = cc.Class( {
extends: ActBase,
// 初始化配置数据
initConfig: function() {
// 视图附着
nx.plugin.add( this, [ "view" ] );
this.vattach( "Acts" );
//这边活动不开也要加载配置,因为开服预告要显示奖励
let cfgs = [
"login_days_new_data"
];
this.loadConfigs( cfgs );
},
// 注册协议接受事件
registerProtocals: function() {
// 前端准备完毕
this.RegisterProtocal(21100, this.onAppoint.bind( this ) );
this.RegisterProtocal(21101, this.onGetSuccess.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( 21100, {}, _cb );
},
GetAppoint8Config: function(){
return this.data;
},
// 八日约定 状态相关
onAppoint: function( _data ){
// {"holiday_theme_list":[
// {"theme_id":500,"type":3,"icon":10003,"name":"日常福利","sort":0,"source":331,"start_time":0,"end_time":0,"theme_holiday_list":[]},
// {"theme_id":101,"type":1,"icon":10004,"name":"梦想启航","sort":1,"source":330,"start_time":1688659200,"end_time":1691251199,
// "theme_holiday_list":[
// {"camp_id":1001,"source":333,"config":"login_days_new_data","sort":1,"name":"八日约定"}
// ]}]}
if( nx.dt.objEmpty( _data ) ){
return;
}
let show = false;
let state = _data.status_list;
state.forEach( _state => {
if( _state.status == 2 ){
show = true;
}
} );
// let key = this.tipKeys();
this.openTip( "reward", show );
state.sort( ( a, b ) => {
return a.day - b.day;
} )
this.vset( "appoint8", state );
},
reqGetDayAward: function( _day ){
let protocal = {};
protocal.day = _day;
this.SendProtocal(21101, protocal);
},
querAppoint8State: function(){
let state = this.vget( "appoint8" );
return state;
},
// [21101]:{"code":1,"msg":"","day":2}
onGetSuccess: function( _data ){
if( _data.code == 1 ){
this.reqBaseData();
}
},
// ============================================================
// 活动红点提示
// ============================================================
// 活动用到的提示KEY
tipKeys: function() {
return ["appoint8"];
},
} );
// 模块导出
module.exports = ActDay8;