80 lines
2.1 KiB
JavaScript
80 lines
2.1 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '63951y/CnhPWJlWUFjUOSTg', 'cmp.adventure.partner');
|
||
|
|
// Scripts/mod/pve/adventure/cmp/cmp.adventure.partner.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ItemBase = require("cmp.partner.com");
|
||
|
|
var ADVCT = require("adventure_controller");
|
||
|
|
var AdventureEVT = require("adventure_event");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ItemBase,
|
||
|
|
properties: {
|
||
|
|
nodLev: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodHp: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
hpBar: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.ProgressBar
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 重载:刷新
|
||
|
|
freshAll: function freshAll() {
|
||
|
|
this._super();
|
||
|
|
if (this.mdata.now_hp != null || this.mdata.hp_per != null) {
|
||
|
|
//有血條顯示 this.mdata.now_hp >= 0 || this.mdata.hp_per > 0
|
||
|
|
this.is_select = false; //不需要選人
|
||
|
|
this.nodLev.active = false;
|
||
|
|
this.nodHp.active = true;
|
||
|
|
this.setHp();
|
||
|
|
this.setPerHp();
|
||
|
|
} else {
|
||
|
|
//沒有血條
|
||
|
|
this.is_select = true; //需要選人
|
||
|
|
this.nodLev.active = true;
|
||
|
|
this.nodHp.active = false;
|
||
|
|
}
|
||
|
|
var nod = nx.gui.find(this, "qa");
|
||
|
|
// let cfg = game.configs.partner_data.data_partner_base[this.mdata.bid];
|
||
|
|
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);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 置空
|
||
|
|
setEmpty: function setEmpty() {
|
||
|
|
this._super();
|
||
|
|
var nod = nx.gui.find(this, "qa");
|
||
|
|
if (nod) {
|
||
|
|
nx.gui.setActive(nod, "", false);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setHp: function setHp() {
|
||
|
|
this.hpBar.progress = this.mdata.now_hp / this.mdata.hp;
|
||
|
|
if (this.mdata.now_hp <= 0) {//死亡
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setPerHp: function setPerHp() {
|
||
|
|
if (!this.mdata.hp_per) return;
|
||
|
|
this.hpBar.progress = this.mdata.hp_per / 100;
|
||
|
|
},
|
||
|
|
onSelectHero: function onSelectHero() {},
|
||
|
|
onFocus: function onFocus() {
|
||
|
|
if (this.nodFocus) {
|
||
|
|
this.nodFocus.node.active = true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
outFocus: function outFocus() {
|
||
|
|
if (this.nodFocus) {
|
||
|
|
this.nodFocus.node.active = false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|