"use strict"; cc._RF.push(module, 'b8dee/+LVhNS4na5Dan2pgA', 'cmp.endless.item.help'); // Scripts/mod/pve/endless_trail/cmp/cmp.endless.item.help.js "use strict"; var ItemBase = require("nx.fx.sv.expand.item"); var PathTool = require("pathtool"); var EndlessEvent = require("endless_trail_event"); var HeroVo = require("hero_vo"); cc.Class({ "extends": ItemBase, properties: { role_name: { "default": null, type: cc.Label }, role_power: { "default": null, type: cc.Label }, help: { "default": null, type: cc.Node }, lock: { "default": null, type: cc.Node }, heroNd: { "default": null, type: cc.Node }, focus: { "default": null, type: cc.Node }, fabHero: { "default": null, type: cc.Prefab } }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() {}, // 数据重置 rebind: function rebind(_idx, _data, _key) { this._super(_idx, _data, _key); // 刷新 this.setData(_data, _key); }, onFocus: function onFocus() { this.focus.active = true; }, outFocus: function outFocus() { this.focus.active = false; }, setData: function setData(data, key) { if (nx.dt.objEmpty(data)) { return false; } this.data = data; this.type = data.type; this.info_data = data.info_data; this.index = data._index; if (!this.hero_icon) { this.hero_icon = cc.instantiate(this.fabHero); this.hero_icon.parent = this.heroNd; } var cmp = nx.gui.getComponent(this.hero_icon, "", "cmp.partner.com"); if (key == "my") { //我的支援 this.role_name.string = this.info_data.name; this.role_power.string = this.info_data.power; cmp.setData(this.info_data); } else { //好友支援 var vo = new HeroVo(); vo.bid = data.bid; vo.lev = data.lev; vo.power = data.power; vo.quality = data.quality; vo.star = data.star; vo.ext_data = data.ext_data; cmp.setData(vo); this.role_power.string = data.power; var config = game.configs.partner_data.data_partner_base[data.bid]; if (config) { this.role_name.string = config.name; } if (data.is_lock) { this.lock.active = true; this.help.active = false; } else { this.lock.active = false; this.help.active = true; } this.updateBtnStatus(data.select); } }, updateBtnStatus: function updateBtnStatus(status) { this.cur_status = status; if (status) { nx.gui.setString(this.help, "txt", nx.text.getKey("lab_endless_trail_help_change_choose")); } else { nx.gui.setString(this.help, "txt", nx.text.getKey("lab_endless_trail_help_item_tip")); } }, onClickSelect: function onClickSelect() { if (this.data.select == true) { gcore.GlobalEvent.fire(EndlessEvent.UPDATA_HELP_CALL, this.data, this.index, false); // this.click_fun(this.data, this.index) } else { gcore.GlobalEvent.fire(EndlessEvent.UPDATA_HELP_CALL, this.data, this.index, true); // this.click_fun(this.data, this.index) } } // update (dt) {}, }); cc._RF.pop();