Files
fc/dev/project/library/imports/f5/f5f972af-9c47-4dde-a02a-bebb71da6dc9.js
T

101 lines
2.5 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, 'f5f97KvnEdN3qAqvrtx2m3J', 'cmp.worldmap.level.details');
// Scripts/mod/pve/worldmap/cmp.worldmap.level.details.js
"use strict";
/******************************************************************
*
* 世界地图关卡详情
*
******************************************************************/
cc.Class({
"extends": cc.Component,
properties: {
teamGrid: {
"default": null,
type: cc.Node
},
btnBattle: {
"default": null,
type: cc.Node
},
btnDrops: {
"default": null,
type: cc.Node
},
nodDone: {
"default": null,
type: cc.Node
}
},
// 设置
setData: function setData(_data) {
this.data = _data;
if (nx.dt.objEmpty(_data)) {
return;
}
// 关卡数据
var cfgs = Utils.getUnitConfig(_data.unit_id);
if (!cfgs) {
nx.error("$WorldMap:关卡敌方无效!" + _data.unit_id);
return;
}
// 获取阵型配置
var type = cfgs.formation[0];
var info = game.configs.formation_data.data_form_data[type];
if (!info) {
nx.error("$WorldMap:关卡敌方站位无效!" + _data.unit_id);
return;
}
this.setFormation(cfgs, info.pos);
this.btnBattle.active = _data.cur;
this.nodDone.active = !_data.cur;
},
// 设置阵容
setFormation: function setFormation(_cfgs, _pos) {
this.teamGrid.children.forEach(function (_t) {
nx.gui.setActive(_t, "head", false);
});
for (var i = 0; i < _pos.length; ++i) {
var idx = _pos[i][0];
var pos = _pos[i][1];
var node = nx.gui.find(this.teamGrid, "p" + pos);
var monster = Utils.getUnitConfig(_cfgs['monster' + idx]);
if (!monster) {
continue;
}
nx.gui.setActive(node, "head", true);
// 等级
nx.gui.setString(node, "head/lv", monster.lev);
// 阵营
var path = cc.path.join("coms/images/camps" + monster.camp_type);
nx.gui.setSpriteFrame(node, "head/camp", path);
// 头像
var pcfg = game.configs.partner_data.data_partner_base[monster.head_icon];
nx.bridge.setIcon(node, "head/avatar", pcfg.item_id);
}
},
// 点击出击
onTouchBattle: function onTouchBattle() {
if (!this.data) {
return;
}
nx.bridge.closePanel("WndWorldMap");
},
// 查看掉落
onTouchDrop: function onTouchDrop() {
if (!this.data) {
return;
}
nx.bridge.createPanel("WndWorldMapReward", this.data);
}
});
cc._RF.pop();