79 lines
2.4 KiB
JavaScript
79 lines
2.4 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'c13769LSFdAgLzm4Uo5Puyo', 'cmp.partner.holy.select.item');
|
|
// Scripts/mod/partner/cmps/basic/cmp.partner.holy.select.item.js
|
|
|
|
"use strict";
|
|
|
|
var ItemBase = require("cmp.item.base");
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
|
var TipsController = require("tips_controller");
|
|
var BackPackConst = require("backpack_const");
|
|
var BIT = BackPackConst.item_type;
|
|
cc.Class({
|
|
"extends": SVCItem,
|
|
properties: {
|
|
cmpItem: {
|
|
"default": null,
|
|
type: ItemBase,
|
|
displayName: "图标"
|
|
}
|
|
},
|
|
// 数据重置
|
|
rebind: function rebind(_idx, _data, _key) {
|
|
this._super(_idx, _data, _key);
|
|
|
|
// 刷新
|
|
this.setData(_data);
|
|
},
|
|
// 重置
|
|
setData: function setData(_data, _count) {
|
|
this.mdata = _data;
|
|
if (_data) {
|
|
this.cmpItem.setData(_data, _count);
|
|
this.freshInfo();
|
|
}
|
|
},
|
|
freshInfo: function freshInfo() {
|
|
var title = game.configs.attr_data.data_key_to_name[this.mdata.config.ext[0][1][0][0]];
|
|
var val = this.mdata.config.ext[0][1][0][1];
|
|
nx.gui.setString(this, "prop/key", title);
|
|
nx.gui.setString(this, "prop/txt", val);
|
|
var path = cc.path.join("coms/images", "star" + this.mdata.config.eqm_star);
|
|
nx.gui.setSpriteFrame(this.cmpItem, "bg/star", path);
|
|
var holy_eqm_attr = [];
|
|
for (var i = 0; i < this.mdata.holy_eqm_attr.length; i++) {
|
|
var data = this.mdata.holy_eqm_attr[i];
|
|
if (data.pos <= 2) {
|
|
holy_eqm_attr.push(data);
|
|
}
|
|
}
|
|
var nodes = nx.gui.find(this, "atts/nod");
|
|
if (nx.dt.arrEmpty(holy_eqm_attr)) {
|
|
nx.gui.setString(nodes, "info/txt", nx.text.getKey("AttrNone"));
|
|
} else {
|
|
nx.gui.gocChildren(nodes, "", holy_eqm_attr.length);
|
|
for (var _i = 0; _i < holy_eqm_attr.length; _i++) {
|
|
var item = holy_eqm_attr[_i];
|
|
var node = nodes.children[_i];
|
|
var atttitle = game.configs.attr_data.data_id_to_name[item.attr_id];
|
|
nx.gui.setString(node, "name", atttitle);
|
|
nx.gui.setString(node, "txt", item.attr_val);
|
|
}
|
|
}
|
|
},
|
|
// 点击装备
|
|
onTouchEquip: function onTouchEquip() {
|
|
var svc = this.node.svc;
|
|
if (svc && svc.binder && svc.binder.onEquip) {
|
|
svc.binder.onEquip(this.mdata);
|
|
}
|
|
},
|
|
onTouchIcon: function onTouchIcon() {
|
|
var TC = TipsController.getInstance();
|
|
if (TC && this.mdata) {
|
|
TC.showItemTips(this.mdata);
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |