Files
fc/dev/project/library/imports/08/08428b02-7af1-46da-a0c4-6ec2322ea561.js
T

184 lines
5.2 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '08428sCevFG2qDEbsIyLqVh', 'cmp.heaven.fightinfo');
// Scripts/mod/pve/heaven/cmp/cmp.heaven.fightinfo.js
"use strict";
var BridgeWindow = require("bridge.window");
var HEACT = require("heaven_controller");
var ItemLay = require("cmp.common.itemlayout");
var HeroVo = require("hero_vo");
var HeroController = require("hero_controller");
cc.Class({
"extends": BridgeWindow,
properties: {
chapter: {
"default": null,
type: cc.Node
},
powerNum: {
"default": null,
type: cc.Node
},
tasks: {
"default": [],
type: [cc.Node]
},
firstNd: {
"default": null,
type: cc.Node
},
awardLay: {
"default": null,
type: ItemLay
},
btnFight: {
"default": null,
type: cc.Node
},
btnClear: {
"default": null,
type: cc.Node
},
//怪物陣容
monsterInfo: {
"default": null,
type: cc.Node
},
monsterName: {
"default": null,
type: cc.Node
},
heroLay: {
"default": null,
type: ItemLay
},
monsterInfo2: {
"default": null,
type: cc.Node
},
monsterName2: {
"default": null,
type: cc.Node
},
heroLay2: {
"default": null,
type: ItemLay
}
},
// LIFE-CYCLE CALLBACKS:
onLoad: function onLoad() {
this.ctrl = HEACT.getInstance();
this.model = this.ctrl.getModel();
this.is_double = false;
},
start: function start() {},
onOpenConfigs: function onOpenConfigs(params) {
this.stage_cfg = params.cfg;
this.is_pass = params.is_pass; //是否通關
this.updateInfo();
this.updateTask();
this.updateAwards();
this.updateMonster();
},
onPreClosed: function onPreClosed() {
this.awardLay.rebuild([]);
this.heroLay.rebuild([]);
this.heroLay2.rebuild([]);
},
updateInfo: function updateInfo() {
nx.gui.setString(this.chapter, "", this.stage_cfg.id);
nx.gui.setString(this.powerNum, "", this.stage_cfg.power);
if (this.is_pass) {
this.btnClear.active = true;
} else {
this.btnFight.active = true;
}
},
updateTask: function updateTask() {
var custom_data = this.model.getCustomsDataById(this.stage_cfg.id, this.stage_cfg.order_id);
if (!custom_data) return;
var star_info = custom_data.star_info;
var con_info = this.stage_cfg.cond_info;
for (var i = 0; i < star_info.length; i++) {
var con_cfg = game.configs.dungeon_heaven_data.data_star_cond[con_info[i][1]];
var item = this.tasks[i];
if (con_cfg && item) {
item.active = true;
nx.gui.setActive(item, "star/get", star_info[i].flag == 1);
nx.gui.setString(item, "scroll/txt", con_cfg.type);
}
}
},
updateAwards: function updateAwards() {
if (!this.is_pass) {
nx.gui.setString(this.firstNd, "", nx.text.getKey("lab_endless_reward_title"));
} else {
nx.gui.setString(this.firstNd, "", nx.text.getKey("ReWards"));
}
var list = [];
if (this.is_pass) {
list = this.stage_cfg.show_award;
} else {
list = this.stage_cfg.f_show_award;
}
this.awardLay.rebuild(list);
},
updateMonster: function updateMonster() {
var team_num = this.stage_cfg.unit_id.length;
if (team_num > 1) {
this.is_double = true;
}
for (var index = 0; index < team_num; index++) {
var unit_data = Utils.getUnitConfig(this.stage_cfg.unit_id[index]);
var list = [];
for (var i = 1; i <= 5; i++) {
var mons_id = unit_data["monster" + i];
var cfg = Utils.getUnitConfig(mons_id);
if (cfg) {
var hero = new HeroVo();
hero.setAttr("bid", Number(cfg.head_icon));
hero.setAttr("lev", cfg.lev);
hero.setAttr("career", cfg.career);
hero.setAttr("camp_type", cfg.camp_type);
hero.setAttr("name", cfg.name);
hero.setAttr("star", cfg.star);
list.push(hero);
}
}
if (index == 0) {
nx.gui.setString(this.monsterName, "", nx.text.getKey("arenateam_fight_tips_4") + 1);
this.heroLay.rebuild(list);
} else if (index == 1) {
nx.gui.setString(this.monsterName2, "", nx.text.getKey("arenateam_fight_tips_4") + 2);
this.heroLay2.rebuild(list);
}
}
},
clickMonsterInfo: function clickMonsterInfo() {
this.monsterInfo.active = !this.monsterInfo.active;
if (this.is_double) {
this.monsterInfo2.active = !this.monsterInfo2.active;
}
},
clickFightClear: function clickFightClear() {
this.ctrl.checkHeavenSweep(this.stage_cfg.id, this.stage_cfg.order_id);
},
clickFight: function clickFight() {
// HeroController.getInstance().openFormGoFightPanel(true,97,{chapter_id:this.stage_cfg.id,customs_id:10},1);
if (this.stage_cfg.order_id == 10) {
HeroController.getInstance().openFormGoFightPanel(true, 97, {
chapter_id: this.stage_cfg.id,
customs_id: this.stage_cfg.order_id
}, 1);
} else {
HeroController.getInstance().openFormGoFightPanel(true, 98, {
chapter_id: this.stage_cfg.id,
customs_id: this.stage_cfg.order_id
}, 1);
}
this.close();
} // update (dt) {},
});
cc._RF.pop();