Files
fc/dev/project/library/imports/33/33472d96-0b47-470b-a0e9-fe88669b2fd3.js
2026-05-24 10:21:26 +08:00

59 lines
1.4 KiB
JavaScript

"use strict";
cc._RF.push(module, '334722WC0dHC6Dp/ohmmy/T', 'cmp.act.upstar.item.hero');
// Scripts/mod/acts/upstar/cmp/cmp.act.upstar.item.hero.js
"use strict";
var ItemBase = require("nx.fx.sv.expand.item");
var HeroController = require("hero_controller");
cc.Class({
"extends": ItemBase,
properties: {
tag: {
"default": null,
type: cc.Node
},
focusNd: {
"default": null,
type: cc.Node
},
fabItem: {
"default": null,
type: cc.Prefab
}
},
// LIFE-CYCLE CALLBACKS:
rebind: function rebind(_index, _data, _key) {
this._super(_index, _data, _key);
this.setData(_data, _key);
},
setData: function setData(data, key) {
if (nx.dt.objEmpty(data)) return;
var hero = null;
if (key == 351) {
hero = HeroController.getInstance().getModel().getHeroById(data.partner_id);
} else if (key == 475) {
hero = data.partner_baseid;
}
if (!this.hero) {
this.hero = cc.instantiate(this.fabItem);
this.hero.parent = this.tag;
}
var cmp = nx.gui.getComponent(this.hero, "", "cmp.item.base");
if (hero && cmp) {
cmp.rebind(this.index, hero, "");
}
},
onFocus: function onFocus() {
if (this.focusNd) {
this.focusNd.active = true;
}
},
outFocus: function outFocus() {
if (this.focusNd) {
this.focusNd.active = false;
}
} // update (dt) {},
});
cc._RF.pop();