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: { nodSplinter: { default: null, type: cc.Node }, }, freshAll: function() { // 置空 if( nx.dt.objEmpty( this.info ) ) { this.setEmpty(); return; } // 基本信息 this.setQuality( this.info.quality ); this.setIcon( this.info.icon ); this.setName( this.info.name ); this.setDescribe( this.info.desc ); this.setRareEft( this.info.mark ); // 角标 this.freshLT(); this.freshRT(); if( this.info.type == BTT.PARTNER_DEBRIS ) { let ifg = gdata( "item_data", "data_unit6", this.info.item_id ); if( ifg ) { // console.log( "当前的碎片相关" + JSON.stringify( ifg ) ); let pfg = {}; if( nx.dt.arrEmpty( ifg.effect ) ) { this.setCount( this.info.count ); this.setStars( this.info.stars || this.info.eqm_jie ); // pfg = { // init_star : this.info.eqm_jie, // quality : this.info.quality, // } nx.gui.setActive( this.nodSplinter, "", false ); // return; } else { pfg = game.configs.partner_data.data_partner_base[ ifg.effect[ 0 ].val ]; let star = nx.gui.find( this.nodSplinter, "star" ); this.setCount( this.info.count ); if( !star ) { return; } if( !nx.dt.numPositive( pfg.init_star, false ) ) { nx.gui.setSpriteFrame( star, "", null ); return; } let path = cc.path.join( "coms/images", "star" + pfg.init_star ); nx.gui.setSpriteFrame( star, "", path ); let nod = nx.gui.find( this.nodSplinter, "qa" ); if( nod ) { let pathsmall = pfg && pfg.quality != 1 ? "coms/images/mk_sqa" + pfg.quality : this.info.stars || null; nx.gui.setSpriteFrame( nod, "", pathsmall ); } nx.gui.setActive( this.nodSplinter, "", true ); } } } else { // 星级/数量是否互斥 if( !this.mutexStarCount ) { this.setCount( this.info.count ); this.setStars( this.info.stars || this.info.eqm_jie ); } else { if( this.ignoreOne && this.info.count <= 1 ) { this.setCount( 0 ); this.setStars( this.info.stars || this.info.eqm_jie ); } else { this.setCount( this.info.count ); this.setStars( 0 ); } } } }, // 单设:数量 setCount: function( _count ) { // 碎片获取合成配置,显示进度 if( this.nodCount && this.info && ( this.info.type == BTT.PARTNER_DEBRIS || this.info.type == BTT.SKIN_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 ); }, setEmpty: function() { this._super(); if( this.nodSplinter ) { nx.gui.setActive( this.nodSplinter, "", false ); } if( this.imgRT ) { nx.gui.setActive( this.imgRT, "time", false ); } }, } );