129 lines
4.2 KiB
JavaScript
129 lines
4.2 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'cf40bGEzYtDS6gEWbLZIRb5', 'cmp.partner.inbag');
|
|
// Scripts/mod/partner/cmps/bag/cmp.partner.inbag.js
|
|
|
|
"use strict";
|
|
|
|
var ItemBase = require("cmp.item.base");
|
|
var HeroController = require("hero_controller");
|
|
var HeroCalculate = require("hero_calculate");
|
|
cc.Class({
|
|
"extends": ItemBase,
|
|
properties: {
|
|
nodTeam: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 重载:刷新
|
|
freshAll: function freshAll() {
|
|
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);
|
|
var nod = nx.gui.find(this, "qa");
|
|
if (nod) {
|
|
var 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);
|
|
var spnod = nx.gui.find(nod, "spine");
|
|
if (spnod) {
|
|
var sp = nx.gui.getComponent(spnod, "", "nx.fx.spine");
|
|
var 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, function (_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 setEmpty() {
|
|
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);
|
|
var nod = nx.gui.find(this, "qa");
|
|
if (nod) {
|
|
nx.gui.setActive(nod, "", false);
|
|
}
|
|
},
|
|
// 设置阵营
|
|
setCamp: function setCamp(_camp) {
|
|
if (!this.imgLT) {
|
|
return;
|
|
}
|
|
if (this.mdata.type <= 5) {
|
|
var 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 setCount(_count) {
|
|
// 不显示数量
|
|
},
|
|
freshRTInfo: function freshRTInfo() {
|
|
if (this.nodTeam) {
|
|
nx.gui.setActive(this.nodTeam, "", this.mdata.is_in_form > 0);
|
|
}
|
|
},
|
|
// 单设:等级
|
|
setLevel: function setLevel(_lev) {
|
|
nx.gui.setString(this.nodCount, "", "Lv." + _lev);
|
|
},
|
|
// 点击
|
|
onTouchTip: function onTouchTip() {
|
|
var HC = HeroController.getInstance();
|
|
if (HC && this.mdata) {
|
|
HC.openHeroMainInfoWindow(true, this.mdata);
|
|
}
|
|
},
|
|
checkTip: function checkTip() {
|
|
var calculate = HeroCalculate.getInstance();
|
|
if (this.key == "partner") {
|
|
if (this.mdata.is_in_form > 0) {
|
|
var tip = calculate.checkSingleHeroLevelUpRedPoint(this.mdata);
|
|
var tipEqm = calculate.checkSingleHeroEquipRedPoint(this.mdata);
|
|
var tipUpstar = calculate.checkSingleHeroUpgradeStarRedPoint(this.mdata);
|
|
var 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 );
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |