"use strict"; cc._RF.push(module, 'f4053FBc+9I97Vezy279GeE', 'cmp.planesafk.item.hire'); // Scripts/mod/pve/planesafk/cmp/cmp.planesafk.item.hire.js "use strict"; var ItemBase = require("nx.fx.sv.expand.item"); var HeroVo = require("hero_vo"); cc.Class({ "extends": ItemBase, properties: { tog: { "default": null, type: cc.Node }, pname: { "default": null, type: cc.Label }, atk: { "default": null, type: cc.Label }, fabHero: { "default": null, type: cc.Prefab }, heroNd: { "default": null, type: cc.Node } }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() {}, // 数据重置 rebind: function rebind(_idx, _data, _key) { this._super(_idx, _data, _key); // 刷新 this.setData(_data); }, setEmpty: function setEmpty() {}, onFocus: function onFocus() { nx.gui.setActive(this.tog, "check", true); }, outFocus: function outFocus() { nx.gui.setActive(this.tog, "check", false); }, setData: function setData(data) { if (nx.dt.objEmpty(data)) { return false; } var hero_base_cfg = gdata("partner_data", "data_partner_base", data.bid); if (!hero_base_cfg) { return; } this.pname.string = hero_base_cfg.name; this.atk.string = data.power || 0; hero_base_cfg.level = data.lev; if (!this.hero_item) { this.hero_item = cc.instantiate(this.fabHero); this.hero_item.parent = this.heroNd; } var hero = new HeroVo(); hero.updateHeroVo(data); hero.camp_type = hero_base_cfg.camp_type; hero.hp_per = null; //需要特殊设置 var cmp = nx.gui.getComponent(this.hero_item, "", "cmp.partner.item.planesafk"); cmp.rebind(0, hero, ""); } // update (dt) {}, }); cc._RF.pop();