Files
fc/dev/project/assets/Scripts/mod/pray/cmp/cmp.holy.eqm.item.js
T
2026-05-23 22:10:14 +08:00

89 lines
2.3 KiB
JavaScript

const ItemBase = require("cmp.item.base");
cc.Class({
extends: ItemBase,
properties: {
nodAdd: { default: null, type: cc.Node },
canDele: false,
},
// 重载:刷新
rebind: function ( _idx, _data, _key ) {
this.mdata = _data;
this.index = _idx;
if( !this.mdata || nx.dt.objEmpty( this.mdata ) ){
this.setEmpty();
return;
}
this.focus = false;
// 等级刷新
let txt = nx.text.getKey( this.mdata.name );
if ( this.lenName > 0 ) {
txt = nx.dt.strCut( txt, this.lenName );
}
this.nodName.string = txt;
let qa = null;
if ( nx.dt.numPositive( this.mdata.quality ) ) {
qa = cc.path.join( "coms/images", "bg_qa" + this.mdata.quality );
}
let set = parseInt( this.mdata.group_id / 100 );
let path = cc.path.join( "coms/images/eqm_set" + set );
nx.gui.setSpriteFrame( this.imgLT, "", path );
nx.gui.setSpriteFrame( this.nodBG, "", qa );
nx.bridge.setIcon( this.nodIcon, "", this.mdata.icon );
if( this.nodAdd ){
nx.gui.setActive( this.nodAdd, "", !this.mdata.icon );
}
if( this.canDele ){
if( this.mdata.inTeam != 0 ){
this.setFocus();
}else{
this.outFocus();
}
}
if( this.index == 0 ){
let cmp = nx.gui.getComponent( this, "", "cmp.plot.trigger" );
if( cmp ){
cmp.pID = "holy_select";
cmp.regist();
}
}
// this.outFocus();
},
setEmpty: function(){
this.nodName.string = "";
nx.gui.setSpriteFrame( this.nodBG, "", "prefab/pray/ui/png_pray_3" );
nx.gui.setSpriteFrame( this.nodIcon, "", "" );
nx.gui.setSpriteFrame( this.imgLT, "", "" );
if( this.canDele ){
this.outFocus();
}
nx.gui.setActive( this.nodAdd, "", true );
},
setFocus: function(){
this.focus = true;
nx.gui.setActive( this.nodFocus.node, "", true );
},
outFocus: function(){
this.focus = false;
nx.gui.setActive( this.nodFocus.node, "", false );
},
});