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

105 lines
3.2 KiB
JavaScript

/******************************************************************
* Copyright(C) 2019 - 2020 Nx Studio
*
* STEP-UP 预览页
*
******************************************************************/
const BridgeComponent = require( "bridge.component" );
const STModel = require( "act.stepup.mod" );
const NxSpine = require( "nx.fx.spine" );
cc.Class( {
extends: BridgeComponent,
properties: {
spRole: { default: null, type: NxSpine },
spMini: { default: null, type: NxSpine },
ndInfo: { default: null, type: cc.Node },
ndRTS: { default: null, type: cc.Node },
},
// 显示
onEnable: function() {
let configs = STModel.getInstance().getConfig();
// const bid = 10507;
const bid = configs.cfgs.partner_bid;
const dat = game.configs.partner_data.data_partner_base[ bid ];
const star = dat.init_star || ( dat ? dat.star : 0 );
const scfgs = gdata( "partner_data", "data_partner_star", `${bid}_${star}` );
if( nx.dt.objEmpty( scfgs ) ) {
nx.error( "STEP-UP 角色无效:", bid );
return;
}
// 名字
nx.gui.setString( this.ndInfo, "name", nx.text.getKey( dat.name ) );
// 角色动画
path = PathTool.getSpinePath( scfgs.res_id, "show", false );
this.spRole.load( path, ( _e ) => {
if( !_e ) {
this.spRole.action( "action1", true );
} else {
this.spRole.stop();
}
} );
// MINI动画
path = PathTool.getSpinePath( scfgs.res_id, scfgs.res_id, false );
this.spMini.load( path, ( _e ) => {
if( !_e ) {
this.spMini.action( "stand2", true );
} else {
this.spMini.stop();
}
} );
// 技能
let sknode = nx.gui.find( this, "infos/skills" );
for( let i = 0; i < sknode.children.length; ++i ) {
// 技能数组[0]为普攻,直接忽略,最多4个技能
let item = sknode.children[ i ];
let sifo = scfgs.skills[ i + 1 ];
if( !sifo ) {
item.active = false;
continue;
}
item.active = true;
let cmp = nx.gui.getComponent( item, "", "cmp.skill.base" );
if( cmp ) {
cmp.setData( sifo[ 1 ] );
}
}
// 广告图
path = cc.path.join( "resDB/acts/steps", "001", nx.getLocLanguage() + "_preview" );
// path = cc.path.join( "locals", nx.getLocLanguage(), "images/acts", "step002" );
nx.gui.setSpriteFrame( this.ndRTS, "img", path );
// 开启日期
let txt = "";
let now = new Date();
let time = configs.cfgs.start_time1;
// let time = [2023, 4, 26, 0, 0, 0];
if( now.getFullYear() != time[ 0 ] ) {
txt += nx.text.format( "SYear", time[ 0 ] );
}
txt += nx.text.format( "SMonth", time[ 1 ] );
txt += nx.text.format( "SDay", time[ 2 ] );
nx.gui.setString( this.ndRTS, "open/txt", nx.text.format( "StepUpPreviewOpen", txt ) );
},
// 皮肤预览
onSkinPreview: function() {
},
} );