Files

123 lines
3.0 KiB
JavaScript
Raw Permalink Normal View History

2026-05-23 22:10:14 +08:00
/*******************************************************************************
*
* 活动:星界初体验
*
*
******************************************************************************/
const ActBase = require( "act.base" );
const PartnerTrial = cc.Class( {
extends: ActBase,
// 初始化配置数据
initConfig: function() {
// 视图附着
nx.plugin.add( this, [ "view" ] );
this.vattach( "Acts" );
},
// 注册协议接受事件
registerProtocals: function() {
this.RegisterProtocal(31004, this.handle31004.bind(this) );//获取活动信息
this.RegisterProtocal(31003, this.handle31003.bind(this) );//领取限时英雄
this.RegisterProtocal(31005, this.handle31005.bind(this) );
this.RegisterProtocal(31006, this.handle31006.bind(this) );
},
// 从服务器初始化数据
reqBaseFromServer: function( _cb ) {
let cfgs = [
"partner_try_data",
]
this.loadConfigs( cfgs, ( _ret, _data ) =>{
this.reqBaseData(_cb);
} )
},
// 请求剧情信息
reqBaseData: function( _cb ) {
this.send31004(_cb);
},
// ============================================================
// 星界初体验(角色试用)
// ============================================================
//任務信息
send31004(_cb){
this.SendProtocal(31004, {},_cb)
},
handle31004: function( _data ) {
if( !this.isGoodData( _data ) ) {
this.vset( "heroTrialData", {} );
return;
}
this.vset( "heroTrialData", _data);
// 提示刷新
this.freshTips( _data.finish );
},
//领取
send31003(id,_cb){
this.SendProtocal(31003,{
id:id
},_cb)
},
handle31003: function( _data ) {
nx.bridge.acts.reqActsRewards();
if( !this.isGoodData( _data ) ) {
return;
}
},
//是否彈窗。作爲是否強彈pv的依據
send31005(_cb){
this.SendProtocal(31005,{},_cb)
},
handle31005: function( _data ) {
if( !this.isGoodData( _data ) ) {
this.vset("PVPlayFlag",0);
return;
}
this.vset("PVPlayFlag",_data.flag);
},
//首次瀏覽,保存狀態
send31006(_cb){
this.SendProtocal(31006,{},_cb)
},
handle31006: function( _data ) {
if( !this.isGoodData( _data ) ) {
return;
}
this.vset("PVPlayFlag",0);
},
// ============================================================
// 活动红点提示
// ============================================================
// // 活动用到的提示KEY
// tipKeys: function() {
// return ["star5","star6","star7","star8","star9","star10"];
// },
// 红点提示更新
freshTips: function( _finish ) {
this.openTip( "reward", _finish == 0 );
},
} );
// 模块导出
module.exports = PartnerTrial;