54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
"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(); |