const ItemBase = require("cmp.item.base"); const HeroController = require("hero_controller"); const HeroCalculate = require( "hero_calculate" ); cc.Class({ extends: ItemBase, properties: { nodTeam: { default : null, type:cc.Node }, }, // 重载:刷新 freshAll: function () { this._super(); // 等级刷新 this.setLevel(this.info.level); this.freshRTInfo(); this.checkTip(); nx.gui.setActive( this, "ssr", this.mdata.quality >= 4 ); nx.gui.setActive( this, "lock", this.mdata.is_lock != 0 ); nx.gui.setActive( this, "try", this.mdata.trial_end_time && this.mdata.trial_end_time != 0 ); let nod = nx.gui.find( this, "qa" ); if( nod ){ let path = ( this.mdata.quality != 1 && nod.children.length == 0 ) || ( this.mdata.quality != 1 && nod.children.length != 0 ) ? "coms/images/mk_sqa" + this.mdata.quality : null; nx.gui.setSpriteFrame( nod, "", path ); let spnod = nx.gui.find( nod, "spine" ); if( spnod ){ let sp = nx.gui.getComponent( spnod, "", "nx.fx.spine" ); let spppath = ""; if( this.mdata.quality == 5 ){ spppath = "resDB/effects/E81054/action"; }else if( this.mdata.quality == 6 ){ spppath = "resDB/effects/E81058/action"; } if( sp && nx.dt.strNEmpty( spppath ) ){ sp.load( spppath, ( _e ) => { if( !_e ) { sp.action( "action2", true ); nx.gui.setSpriteFrame( nod, "", null ); } else { sp.stop(); } } ); } nx.gui.setActive( spnod, "", this.mdata.quality == 5 || this.mdata.quality == 6 ); } nx.gui.setActive( nod, "", true ); } }, setEmpty: function() { this._super(); nx.gui.setActive( this, "ssr", false ); nx.gui.setActive( this.nodTeam, "", false ); nx.gui.setActive( this, "tip", false ); nx.gui.setActive( this, "lock", false ); nx.gui.setActive( this, "try", false ); let nod = nx.gui.find( this, "qa" ); if( nod ){ nx.gui.setActive( nod, "", false ); } }, // 设置阵营 setCamp: function( _camp ) { if ( !this.imgLT ) { return; } if( this.mdata.type <= 5 ){ let sf = cc.path.join( "coms/images/career" + this.mdata.type ); nx.gui.setSpriteFrame( this.imgLT, "", sf ); } // if( this.key == "partner" ){ // let sf = cc.path.join( "coms/images/career" + this.mdata.type ); // nx.gui.setSpriteFrame( this.imgLT, "", sf ); // }else{ // let sf = cc.path.join( "coms/images/camps" + _camp ); // nx.gui.setSpriteFrame( this.imgLT, "", sf ); // } }, // 重载:数量 setCount: function (_count) { // 不显示数量 }, freshRTInfo : function(){ if( this.nodTeam ){ nx.gui.setActive( this.nodTeam, "", this.mdata.is_in_form > 0 ); } }, // 单设:等级 setLevel: function (_lev) { nx.gui.setString(this.nodCount, "", "Lv." + _lev); }, // 点击 onTouchTip: function () { let HC = HeroController.getInstance(); if (HC && this.mdata) { HC.openHeroMainInfoWindow(true, this.mdata); } }, checkTip: function(){ const calculate = HeroCalculate.getInstance(); if( this.key == "partner" ){ if( this.mdata.is_in_form > 0 ){ let tip = calculate.checkSingleHeroLevelUpRedPoint( this.mdata ); let tipEqm = calculate.checkSingleHeroEquipRedPoint( this.mdata ); let tipUpstar = calculate.checkSingleHeroUpgradeStarRedPoint( this.mdata ); let tipInsert= calculate.checkSingleHeroUpgradeStarRedPoint( this.mdata ); nx.mTip.openTip( "partner.partner.upstar", tipUpstar ); nx.mTip.openTip( "partner.partner.uplevel", ( tipEqm || tip ) ); nx.mTip.openTip( "partner.partner.insert", tipInsert ); nx.gui.setActive( this, "tip", ( tipEqm || tip || tipUpstar || tipInsert ) ); }else{ nx.gui.setActive( this, "tip", false ); // nx.mTip.openTip( "partner.partner.uplevel", false ); // nx.mTip.openTip( "partner.partner.upstar", false ); } } } });