Files
fc/dev/project/library/imports/2f/2f89636e-3c50-44fb-8390-da4491f005b4.js
T

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '2f896NuPFBE+4OQ2kSR8AW0', 'cmp.act.optional.item');
// Scripts/mod/acts/optionalparty/cmp/cmp.act.optional.item.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);
},
setData: function setData(data) {
if (nx.dt.objEmpty(data)) return;
var hero = data.partner_id;
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();