79 lines
2.1 KiB
JavaScript
79 lines
2.1 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'b9b2b6MEIpMw5vRPvRMk+Y+', 'cmp.act.encounter.detail');
|
||
|
|
// Scripts/mod/acts/encounter/cmp/cmp.act.encounter.detail.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 銀河奇遇陣容信息
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
var EncounterMod = require("act.encounter.mod");
|
||
|
|
var BridgeWindow = require("bridge.window");
|
||
|
|
var 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 onLoad() {
|
||
|
|
this.mod = EncounterMod.getInstance();
|
||
|
|
this.fake_data = game.configs.fake_battle_data;
|
||
|
|
},
|
||
|
|
onOpenConfigs: function onOpenConfigs(_params) {
|
||
|
|
var enemys_id = _params.target_id;
|
||
|
|
var heros = [];
|
||
|
|
var unit_data = Utils.getUnitConfig(enemys_id);
|
||
|
|
var type = unit_data.formation[0];
|
||
|
|
var info = game.configs.formation_data.data_form_data[type];
|
||
|
|
for (var i = 1; i <= 9; i++) {
|
||
|
|
var is_inForm = false;
|
||
|
|
for (var pos in info.pos) {
|
||
|
|
if (i == info.pos[pos][1]) {
|
||
|
|
var 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: function onPreClosed() {
|
||
|
|
this.formList.rebuild([]);
|
||
|
|
if (this.firstAward) {
|
||
|
|
this.firstAward.destroy();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setFirstAward: function setFirstAward(reward) {
|
||
|
|
if (!reward) return;
|
||
|
|
if (!this.firstAward) {
|
||
|
|
this.firstAward = cc.instantiate(this.fabItem);
|
||
|
|
this.firstAward.parent = this.awardNd;
|
||
|
|
}
|
||
|
|
var cmp = nx.gui.getComponent(this.firstAward, "", "cmp.item.base");
|
||
|
|
if (cmp) {
|
||
|
|
cmp.rebind(0, reward[0], "");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|