Files
fc/dev/project/library/imports/f7/f78b2778-80f3-40eb-a6a4-78276c2bface.js
T

88 lines
2.4 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, 'f78b2d4gPNA66akeCdsK/rO', 'cmp.partner.skill.uplv.wnd');
// Scripts/mod/partner/cmps/skill/cmp.partner.skill.uplv.wnd.js
"use strict";
/******************************************************************
*
* 伙伴技能升级界面
*
******************************************************************/
var BridgeWindow = require("bridge.window");
var BackPackController = require("backpack_controller");
cc.Class({
"extends": BridgeWindow,
properties: {
nodSks: {
"default": null,
type: cc.Node
},
nodNeeds: {
"default": null,
type: cc.Node
}
},
// 重载:参数打开
onOpenConfigs: function onOpenConfigs(_params) {
this.partner = _params.hero_vo;
this.sid = _params.skill_id;
this.cb = _params.cb;
this.fresh();
},
// 刷新
fresh: function fresh() {
var _this = this;
// 配置获取
var cfgs = game.configs.partner_skill_data.data_partner_skill_level[this.sid];
if (nx.dt.objEmpty(cfgs) || !nx.dt.numPositive(cfgs.next_id, false)) {
nx.error("无效技能升级配置:", this.sid);
this.scheduleOnce(function () {
_this.close();
}, 0.03);
return;
}
// 技能信息
var cur = nx.gui.getComponent(this.nodSks, "from/icon", "cmp.skill.base");
cur.setData(this.sid);
var tar = nx.gui.getComponent(this.nodSks, "to/icon", "cmp.skill.base");
tar.setData(cfgs.next_id);
var BC = BackPackController.getInstance();
var BM = BC.getModel();
// 耗材
this.enough = true;
var expend = cfgs ? cfgs.expend : [];
var temp = nx.gui.find(this.nodNeeds, "list");
for (var i = 0; i < temp.children.length; ++i) {
var item = temp.children[i];
var info = expend[i];
if (!info) {
nx.gui.setActive(item, "", false);
continue;
}
nx.gui.setActive(item, "", true);
var cmp = nx.gui.getComponent(item, "", "cmp.item.base");
if (cmp) {
cmp.setData(info[0]);
var hcnt = BM.getItemNumByBid(info[0]);
nx.gui.setString(cmp, "count", nx.dt.shortCount(info[1]) + "/" + nx.dt.shortCount(hcnt));
var eno = hcnt >= info[1];
nx.gui.setColor(cmp, "count", eno ? cc.Color.WHITE : cc.Color.RED);
if (!eno) {
this.enough = false;
}
}
}
},
// 点击确认
onTouchConfirm: function onTouchConfirm() {
// 返回
nx.dt.fnInvoke(this.cb, true);
this.close();
}
});
cc._RF.pop();