Files
fc/dev/project/library/imports/17/172c302c-88e8-4f8b-b5db-257ca96fff97.js
2026-05-24 10:21:26 +08:00

154 lines
4.2 KiB
JavaScript

"use strict";
cc._RF.push(module, '172c3AsiOhPi7XbJXypb/+X', 'cmp.battledrama.item.hallowselect');
// Scripts/mod/battle_drama/cmp/form/cmp.battledrama.item.hallowselect.js
"use strict";
var ItemBase = require("nx.fx.sv.expand.item");
var PathTool = require("pathtool");
;
var BackPackConst = require("backpack_const");
var HallowsController = require("hallows_controller");
cc.Class({
"extends": ItemBase,
properties: {
focusNd: {
"default": null,
type: cc.Node
},
confirm_btn: {
"default": null,
type: cc.Node
},
cancel_btn: {
"default": null,
type: cc.Node
},
look_btn: {
"default": null,
type: cc.Node
},
lock_btn: {
"default": null,
type: cc.Node
},
hallow_name: {
"default": null,
type: cc.RichText
},
hallow_desc: {
"default": null,
type: cc.Label
},
hallowNd: {
"default": null,
type: cc.Node
},
fabItem: {
"default": null,
type: cc.Prefab
}
},
// LIFE-CYCLE CALLBACKS:
onLoad: function onLoad() {},
// 数据重置
rebind: function rebind(_idx, _data, _key) {
this._super(_idx, _data, _key);
// 刷新
this.setData(_data);
},
setData: function setData(data) {
if (nx.dt.objEmpty(data)) {
return false;
}
var self = this;
self.hallow_vo = data.hallow_vo;
self.hallow_cfg = data.hallow_cfg;
self.select_cb = data.select_cb;
self.updateWidgets();
},
updateWidgets: function updateWidgets() {
if (!this.item_icon) {
this.item_icon = cc.instantiate(this.fabItem);
this.item_icon.parent = this.hallowNd;
}
var cmp = this.item_icon.getComponent("cmp.item.base");
cmp.rebind(0, this.hallow_cfg.item_id, "");
// 名字
var lev,
key = null;
if (!!this.hallow_vo) {
key = this.hallow_cfg.id + "_" + this.hallow_vo.skill_lev;
lev = this.hallow_vo.step;
} else {
key = this.hallow_cfg.id + "_" + 1;
lev = 1;
}
var name_str = cc.js.formatStr("%s <color=#f1270c>(%s %s)</color>", this.hallow_cfg.name, nx.text.getKey("msg_vedio_item_panel_tip5"), lev);
this.hallow_name.string = name_str;
// var name_color_hex = BackPackConst.quality_color(item_cfg.quality)
// var color = this.hallow_name.color;
// color.fromHEX(name_color_hex);
// this.hallow_name.color = color;
// 详细信息
var skill_up_cfg = gdata("hallows_data", "data_skill_up", key);
var skill_cfg = gskilldata("data_get_skill", skill_up_cfg.skill_bid);
if (skill_cfg) {
this.hallow_desc.string = cc.js.formatStr(skill_cfg.des, skill_cfg.hallows_atk, 0);
} else {
this.hallow_desc.string = nx.text.getKey("lab_hallows_select_item_tip3");
}
if (!!this.hallow_vo) {
this.look_btn.active = true;
this.lock_btn.active = false;
// this.open_txt_nd.active = false;
if (this.hallow_vo.is_equip) {
this.confirm_btn.active = false;
this.cancel_btn.active = true;
} else {
this.confirm_btn.active = true;
this.cancel_btn.active = false;
}
} else {
this.lock_btn.active = true;
this.confirm_btn.active = false;
this.cancel_btn.active = false;
this.look_btn.active = false;
}
},
// onFocus(){
// this.focusNd.active = true;
// },
// outFocus(){
// this.focusNd.active = false;
// },
onTouchLook: function onTouchLook() {
var act_vo = HallowsController.getInstance().getModel().getHallowsById(this.hallow_vo.id);
if (this.hallow_vo) {
if (act_vo) {
HallowsController.getInstance().openHallowsTips(true, act_vo);
} else {
var max_vo = HallowsController.getInstance().getModel().makeHighestHallowVo(this.hallow_vo.id);
HallowsController.getInstance().openHallowsTips(true, max_vo);
}
}
},
onClickComfirmBtn: function onClickComfirmBtn() {
if (this.select_cb) {
this.select_cb(this.hallow_vo);
nx.bridge.closePanel("WndHallowSelect");
}
},
onClickCancelBtn: function onClickCancelBtn() {
if (this.select_cb) {
this.select_cb(null);
nx.bridge.closePanel("WndHallowSelect");
}
}
// update (dt) {},
});
cc._RF.pop();