"use strict"; cc._RF.push(module, 'c394aZicqpKVZ529/anitps', 'cmp.worldmap.level'); // Scripts/mod/pve/worldmap/cmp.worldmap.level.js "use strict"; /****************************************************************** * * 世界地图关卡信息 * ******************************************************************/ var NxSpine = require("nx.fx.spine"); cc.Class({ "extends": cc.Component, properties: { labTitle: { "default": null, type: cc.Label }, spMini: { "default": null, type: NxSpine }, nodName: { "default": null, type: cc.Node } }, // 设置 setData: function setData(_data) { var _this = this; this.data = _data; if (nx.dt.objEmpty(_data)) { return; } // 关卡名 this.labTitle.string = nx.text.getKey(_data.name); // 关卡数据 var cfgs = Utils.getUnitConfig(_data.unit_id); if (!cfgs) { nx.error("$WorldMap:关卡敌方无效!" + _data.unit_id); return; } // 获取主怪信息 var key = "monster" + cfgs.main_monster; var bossId = cfgs[key]; var boss = Utils.getUnitConfig(bossId); if (!boss) { nx.error("$WorldMap:关卡敌方主怪无效!" + bossId); return; } // 主怪名 nx.gui.setString(this.nodName, "txt", nx.text.getKey(boss.name)); // 阵营 var path = cc.path.join("coms/images/camps" + boss.camp_type); nx.gui.setSpriteFrame(this.nodName, "camp", path); // 战斗迷你 path = PathTool.getSpinePath(boss.body_id, boss.body_id, false); this.spMini.load(path, function (_e) { if (!_e) { _this.spMini.action("stand2", true); } else { _this.spMini.stop(); } }); } }); cc._RF.pop();