92 lines
2.3 KiB
JavaScript
92 lines
2.3 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '5c463lxQlJCq71a9hd3BpVe', 'cmp.partner.inform');
|
||
|
|
// Scripts/mod/battle_drama/cmp/form/cmp.partner.inform.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ItemBase = require("cmp.item.base");
|
||
|
|
var HeroController = require("hero_controller");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ItemBase,
|
||
|
|
properties: {
|
||
|
|
employNd: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node,
|
||
|
|
displayName: "雇佣"
|
||
|
|
},
|
||
|
|
dieNd: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 重载:刷新
|
||
|
|
freshAll: function freshAll() {
|
||
|
|
this._super();
|
||
|
|
|
||
|
|
// 等级刷新
|
||
|
|
this.setLevel(this.info.level);
|
||
|
|
this.checkHp();
|
||
|
|
if (this.mdata.is_ui_select) {
|
||
|
|
this.onFocus();
|
||
|
|
} else {
|
||
|
|
this.outFocus();
|
||
|
|
}
|
||
|
|
if (this.mdata.is_try || this.mdata.trial_end_time > 0) {
|
||
|
|
this.setTry();
|
||
|
|
}
|
||
|
|
nx.gui.setActive(this.employNd, "", this.mdata.is_employ);
|
||
|
|
var nod = nx.gui.find(this, "qa");
|
||
|
|
if (nod) {
|
||
|
|
var path = this.mdata.quality != 1 ? "coms/images/mk_sqa" + this.mdata.quality : null;
|
||
|
|
nx.gui.setSpriteFrame(nod, "", path);
|
||
|
|
nx.gui.setActive(nod, "", true);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
checkHp: function checkHp() {
|
||
|
|
if (this.mdata.hp_per != null) {
|
||
|
|
nx.gui.setActive(this.dieNd, "", this.mdata.hp_per == 0);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
EncounterFocus: function EncounterFocus() {
|
||
|
|
this.onFocus();
|
||
|
|
this.onTouch();
|
||
|
|
},
|
||
|
|
setCamp: function setCamp(canceer) {
|
||
|
|
var ceer = game.configs.partner_data.data_partner_base[this.mdata.bid];
|
||
|
|
var val = 0;
|
||
|
|
if (ceer.type) {
|
||
|
|
val = ceer.type;
|
||
|
|
var icon = cc.path.join("coms/images", "career" + val);
|
||
|
|
// 图标设置
|
||
|
|
nx.gui.setSpriteFrame(this.imgLT, "", icon);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 重载:数量
|
||
|
|
setCount: function setCount(_count) {
|
||
|
|
// 不显示数量
|
||
|
|
},
|
||
|
|
// 单设:等级
|
||
|
|
setLevel: function setLevel(_lev) {
|
||
|
|
nx.gui.setString(this.nodCount, "", "Lv." + _lev);
|
||
|
|
},
|
||
|
|
setTry: function setTry() {
|
||
|
|
var sf = cc.js.formatStr("locals/%s/images/sma/bg_try", nx.getLocLanguage());
|
||
|
|
nx.gui.setSpriteFrame(this.imgRT, "", sf);
|
||
|
|
},
|
||
|
|
// 点击
|
||
|
|
onTouchTip: function onTouchTip() {
|
||
|
|
var HC = HeroController.getInstance();
|
||
|
|
if (HC && this.mdata) {
|
||
|
|
HC.openHeroMainInfoWindow(true, this.mdata);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setEmpty: function setEmpty() {
|
||
|
|
this._super();
|
||
|
|
var nod = nx.gui.find(this, "qa");
|
||
|
|
if (nod) {
|
||
|
|
nx.gui.setActive(nod, "", false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|