const ItemBase = require( "cmp.item.base" ); const BackPackConst = require( "backpack_const" ); const HeroControl = require( "hero_controller" ); const BTT = BackPackConst.item_type; cc.Class( { extends: ItemBase, properties: { nodCannot: { default: null, type: cc.Node }, }, freshAll: function(){ let nod = nx.gui.find( this.node, "bg" ); nx.gui.setActive( this.nodCannot, "", false ); this.mdata.canshow = 0; // this.setGray( nod, 0 ); this._super(); }, // 单设:数量 setCount: function ( _count ) { // 碎片获取合成配置,显示进度 if( this.nodCount && this.info && this.info.type == BTT.PARTNER_DEBRIS ) { let cfg = gdata( "partner_data", "data_get_compound_info", this.info.item_id ); if( nx.dt.objNEmpty( cfg ) ) { this.nodCount.string = _count + "/" + cfg.num; return; } } this._super( _count ); }, // 单设:品质 setQuality: function( _qa ) { if ( this.nodBG ) { let qa = null; if ( nx.dt.numPositive( _qa ) ) { let _show = _qa < BackPackConst.quality.golden ? _qa : BackPackConst.quality.red; qa = cc.path.join( "coms/images", "bg_qa" + _show ); } nx.gui.setSpriteFrame( this.nodBG, "", qa ); if( !qa ){ nx.gui.getComponent( this.nodBG, "", cc.Sprite ).curKey = ""; } } }, setGray:function( _nod,_mat ){ let nod = _nod; let sp = nx.gui.getComponent( nod, "qa", cc.Sprite ); let isp = nx.gui.getComponent( nod, "icon", cc.Sprite ); let ssp = nx.gui.getComponent( nod, "stars", cc.Sprite ); let rt = nx.gui.getComponent( nod, "rt/img", cc.Sprite ); let material = _mat == 1 ? cc.Material.getBuiltinMaterial( '2d-gray-sprite' ) : cc.Material.getBuiltinMaterial( '2d-sprite' ) ; sp.setMaterial( 0,material ); isp.setMaterial( 0,material ); ssp.setMaterial( 0,material ); rt.setMaterial( 0,material ); }, setCannotSelect: function( _show ){ let num = 0; let nod = nx.gui.find( this.node, "bg" ); if( this.nodCannot ){ num = _show ? 1 : 0; this.setGray( nod, num ); nx.gui.setActive( this.nodCannot, "", false ); } this.mdata.canshow = num; }, } );