Files

134 lines
3.6 KiB
JavaScript
Raw Permalink Normal View History

2026-05-23 22:10:14 +08:00
/******************************************************************
*
* 升星有禮
*
******************************************************************/
const NxSpine = require("nx.fx.spine");
const NxExpand = require("nx.fx.sv.expand");
const PathTool = require("pathtool");
const TipsController = require("tips_controller");
const HeroUpstarMod = require("act.heroupstar.mod");
// const ActPopup = require( "act.popup.base" );
const ActPage = require( "act.page.base" );
cc.Class( {
extends: ActPage,
properties: {
empNd:{
default:null,
type:cc.Node
},
roleNd:{
default:null,
type:cc.Node
},
role:{
default:null,
type:NxSpine
},
list:{
default:null,
type:NxExpand
},
limitTime:{
default:null,
type:cc.Node
},
heroTip:{
default:null,
type:cc.Node
}
},
// 初始化
// onLoad: function( ) {
// this.mod = HeroUpstarMod.getInstance();
// this.upstar_data = game.configs.holiday_upstars_new_data;
// // 活动监听
// this.mod.vbind( this, [
// [ "heroUpstarAwards", this.freshList.bind( this ) ],
// ] );
// },
// onOpenConfigs(_params){
// this._super( _params );
// this.list.svcKey = this.mod.data.source;
// this.mod.send29211();
// },
// onPreClosed(){
// this.list.rebuild([]);
// // 活动监听解除
// if( this.mod ) {
// this.mod.vunbind( this );
// }
// },
build: function( _data ) {
this._super( _data );
this.upstar_data = game.configs.holiday_upstars_new_data;
// 活动监听
this.mod.vbind( this, [
[ "heroUpstarAwards", this.freshList.bind( this ) ],
] );
},
onEnable(){
this.list.svcKey = this.mod.data.source;
this.mod.send29211( this.mod.data.camp_id );
},
onDisable(){
this.list.rebuild([]);
},
// 销毁
onDestroy: function() {
// 活动监听解除
if( this.mod ) {
this.mod.vunbind( this );
}
this._super();
},
freshList(award_list){
if(!award_list || award_list.length == 0)return;
this.list.rebuild(award_list);
//先設置已經選擇的英雄
let partner_bid = this.mod.getChooseHero().bid;
let cfg = game.configs.partner_data.data_partner_base[partner_bid];
if(partner_bid){
nx.gui.hideAllChildren( this, "left/tag" );
this.empNd.active = false;
let res_path = PathTool.getSpinePath( cfg.bustid, "show", false );
this.role.load( res_path, ( _e ) => {
if( !_e ) {
this.role.action( "action1", true );
} else {
this.role.stop();
}
} );
}else{
this.empNd.active = true;
nx.gui.setSpriteFrame(this.empNd,"",cc.path.join("resDB/empty","half_show"));
}
nx.gui.setCdTxt(this.limitTime,"",this.mod.getLimitTime() - client.socket.getTime());
nx.gui.setString(this.heroTip, "", cc.js.formatStr(nx.text.getKey("HeroUpTag"), cfg ? cfg.name : "" ));
},
onClickRule(){
let TC = TipsController.getInstance();
if( TC ) {
let config = gdata("holiday_upstars_new_data","data_const","desc");
TC.showTextPanel(null,config.desc );
}
},
} );