91 lines
2.1 KiB
JavaScript
91 lines
2.1 KiB
JavaScript
|
|
/*******************************************************************************
|
||
|
|
*
|
||
|
|
* 活动: 月签到
|
||
|
|
*
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
const ActBase = require( "act.base" );
|
||
|
|
const DailyChargeMod = require( "act.dailyfirstcharge.mod" );
|
||
|
|
|
||
|
|
const ActSign30 = cc.Class( {
|
||
|
|
|
||
|
|
extends: ActBase,
|
||
|
|
|
||
|
|
// 初始化配置数据
|
||
|
|
initConfig: function() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 注册协议接受事件
|
||
|
|
registerProtocals: function() {
|
||
|
|
|
||
|
|
this.RegisterProtocal( 21002, this.handle21002.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( 14100, {}, _cb );
|
||
|
|
},
|
||
|
|
|
||
|
|
reqChargeData: function(){
|
||
|
|
|
||
|
|
let dailycharge = DailyChargeMod.getInstance().vget( "dailyfirstCharge" );
|
||
|
|
return dailycharge;
|
||
|
|
},
|
||
|
|
|
||
|
|
handle21002: function( data ) {
|
||
|
|
this.openTip( "reward", data.count > 0 );
|
||
|
|
this.reqBaseData();
|
||
|
|
},
|
||
|
|
|
||
|
|
GetSignStatus: function( _data ){
|
||
|
|
//
|
||
|
|
|
||
|
|
nx.bridge.acts.vset( "sign30", _data );
|
||
|
|
},
|
||
|
|
|
||
|
|
GetSignBack: function( _data ){
|
||
|
|
// {"code":1,"msg":"","day":1,"status":1}
|
||
|
|
if( _data.code == 1 ){
|
||
|
|
this.reqBaseData();
|
||
|
|
}
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
reqSign: function( ){
|
||
|
|
let protocal = {};
|
||
|
|
this.SendProtocal(14101, protocal);
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
// ============================================================
|
||
|
|
// 活动红点提示
|
||
|
|
// ============================================================
|
||
|
|
|
||
|
|
// 活动用到的提示KEY
|
||
|
|
tipKeys: function() {
|
||
|
|
return ["sign30"];
|
||
|
|
},
|
||
|
|
|
||
|
|
} );
|
||
|
|
|
||
|
|
// 模块导出
|
||
|
|
module.exports = ActSign30;
|