Files
fc/dev/project/assets/Scripts/mod/acts/encounter/cmp/cmp.act.encounter.detail.js
T

80 lines
2.1 KiB
JavaScript
Raw Normal View History

2026-05-23 22:10:14 +08:00
/******************************************************************
*
* 銀河奇遇陣容信息
*
******************************************************************/
const EncounterMod = require("act.encounter.mod");
const BridgeWindow = require("bridge.window");
const ItemLay = require("cmp.common.itemlayout");
cc.Class( {
extends: BridgeWindow,
properties: {
formList:{
default:null,
type:ItemLay
},
awardNd:{
default:null,
type:cc.Node
},
fabItem:{
default:null,
type:cc.Prefab
}
},
// 初始化
onLoad: function( ) {
this.mod = EncounterMod.getInstance();
this.fake_data = game.configs.fake_battle_data;
},
onOpenConfigs(_params){
let enemys_id = _params.target_id;
let heros = [];
let unit_data = Utils.getUnitConfig(enemys_id);
let type = unit_data.formation[ 0 ];
let info = game.configs.formation_data.data_form_data[ type ];
for(let i = 1;i<=9;i++){
let is_inForm = false;
for(let pos in info.pos){
if(i == info.pos[pos][1]){
let e_id = "monster"+info.pos[pos][0];
if(unit_data[e_id]){
is_inForm = true;
heros.push(unit_data[e_id]);
}
}
}
if(!is_inForm){
heros.push(0);
}
}
this.formList.rebuild(heros);
this.setFirstAward(_params.reward || []);
},
onPreClosed(){
this.formList.rebuild([]);
if(this.firstAward){
this.firstAward.destroy();
}
},
setFirstAward(reward){
if(!reward)return;
if(!this.firstAward){
this.firstAward = cc.instantiate(this.fabItem);
this.firstAward.parent = this.awardNd;
}
let cmp = nx.gui.getComponent(this.firstAward,"","cmp.item.base");
if(cmp){
cmp.rebind(0,reward[0],"");
}
},
} );