134 lines
3.4 KiB
JavaScript
134 lines
3.4 KiB
JavaScript
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 技能预览界面
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
const BridgeWindow = require( "bridge.window" );
|
||
|
|
const FxTogs = require( "nx.fx.togs" );
|
||
|
|
const FxSVC = require( "nx.fx.sv.expand" );
|
||
|
|
const TipsController = require( "tips_controller" );
|
||
|
|
|
||
|
|
cc.Class( {
|
||
|
|
|
||
|
|
extends: BridgeWindow,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
|
||
|
|
togMenu: { default: null, type: FxTogs },
|
||
|
|
svcList: { default: null, type: FxSVC },
|
||
|
|
btnHelp: { default: null, type: cc.Node },
|
||
|
|
curDesc: { default: null, type: cc.Node },
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 重载:参数打开
|
||
|
|
onOpenConfigs: function( _params ) {
|
||
|
|
|
||
|
|
// 显示类型
|
||
|
|
// 1 是符文技能预览 2 是英雄天赋技能
|
||
|
|
this.stype = _params || 1;
|
||
|
|
nx.gui.setActive( this.btnHelp, "", this.stype == 1 );
|
||
|
|
|
||
|
|
// Tog监听
|
||
|
|
this.togMenu.posTog = this.onTogMenu.bind( this );
|
||
|
|
this.togMenu.togTo( 0 );
|
||
|
|
this.activeMenu( 1 );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 重载:关闭前
|
||
|
|
onPreClosed: function() {
|
||
|
|
|
||
|
|
this.svcList.rebuild( [] );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 等级切换
|
||
|
|
onTogMenu: function( _index ) {
|
||
|
|
this.activeMenu( parseInt( _index ) + 1 );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 激活菜单
|
||
|
|
activeMenu: function( _lv ) {
|
||
|
|
|
||
|
|
console.log( "级别切换:", _lv );
|
||
|
|
if( this.curLevel == _lv ) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.curLevel = _lv;
|
||
|
|
const data = game.configs.partner_artifact_data.data_artifact_skill[ _lv ];
|
||
|
|
this.svcList.rebuild( data );
|
||
|
|
|
||
|
|
// 设置默认
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
this.svcList.cleanFocus();
|
||
|
|
this.svcList.addFocus( 0 );
|
||
|
|
this.setCurrent( data[ 0 ] );
|
||
|
|
}, 0.1 );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 选中切换
|
||
|
|
onFocusChanged: function( _item ) {
|
||
|
|
|
||
|
|
// 空
|
||
|
|
if( !_item || !_item.mdata ) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
nx.audio.playSFX( "audios/effects/touchitem" );
|
||
|
|
// 聚焦
|
||
|
|
this.svcList.cleanFocus();
|
||
|
|
this.svcList.addFocus( _item.index );
|
||
|
|
this.setCurrent( _item.mdata );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 设置当前
|
||
|
|
setCurrent: function( _id ) {
|
||
|
|
|
||
|
|
let info = gskilldata( 'data_get_skill', _id );
|
||
|
|
if( nx.dt.objEmpty( info ) ) {
|
||
|
|
nx.gui.setActive( this.curDesc, "", false );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.sid = _id;
|
||
|
|
nx.gui.setActive( this.curDesc, "", true );
|
||
|
|
|
||
|
|
// 名字
|
||
|
|
nx.gui.setString( this.curDesc, "name", nx.text.getKey( info.name ) );
|
||
|
|
|
||
|
|
// 图标
|
||
|
|
nx.bridge.setIcon( this.curDesc, "icon", info.icon );
|
||
|
|
|
||
|
|
// 描述设置
|
||
|
|
let detail = nx.gui.find( this.curDesc, "detail/view/content" );
|
||
|
|
if( detail ) {
|
||
|
|
|
||
|
|
// 描述
|
||
|
|
let desc = nx.text.getKey( info.des || info.desc );
|
||
|
|
nx.gui.setString( detail, "desc/txt", desc );
|
||
|
|
|
||
|
|
// 冷却
|
||
|
|
let txt = nx.text.getKey( "SkillCD1" );
|
||
|
|
if( info.cd > 0 ) {
|
||
|
|
txt = nx.text.format( "SkillCD2", info.cd );
|
||
|
|
}
|
||
|
|
if( info.fire_cd != 0 ) {
|
||
|
|
txt += nx.text.format( "SkillCD3", info.fire_cd );
|
||
|
|
}
|
||
|
|
nx.gui.setString( detail, "cd/txt", txt );
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 点击帮助
|
||
|
|
onTouchHelp: function() {
|
||
|
|
|
||
|
|
const TC = TipsController.getInstance();
|
||
|
|
const desc = game.configs.partner_skill_data.data_partner_skill_const.skill_rule;
|
||
|
|
TC.showTextPanel( "tip", desc );
|
||
|
|
},
|
||
|
|
|
||
|
|
} );
|