191 lines
5.4 KiB
JavaScript
191 lines
5.4 KiB
JavaScript
|
|
const BridgeWindow = require( "bridge.window" );
|
||
|
|
const HEACT = require("heaven_controller");
|
||
|
|
const ItemLay = require("cmp.common.itemlayout");
|
||
|
|
const HeroVo = require("hero_vo");
|
||
|
|
const 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 () {
|
||
|
|
this.ctrl = HEACT.getInstance();
|
||
|
|
this.model = this.ctrl.getModel();
|
||
|
|
this.is_double = false;
|
||
|
|
},
|
||
|
|
|
||
|
|
start () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onOpenConfigs(params) {
|
||
|
|
this.stage_cfg = params.cfg;
|
||
|
|
this.is_pass = params.is_pass;//是否通關
|
||
|
|
this.updateInfo();
|
||
|
|
this.updateTask();
|
||
|
|
this.updateAwards();
|
||
|
|
this.updateMonster();
|
||
|
|
},
|
||
|
|
|
||
|
|
onPreClosed() {
|
||
|
|
this.awardLay.rebuild([]);
|
||
|
|
this.heroLay.rebuild([]);
|
||
|
|
this.heroLay2.rebuild([]);
|
||
|
|
},
|
||
|
|
|
||
|
|
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(){
|
||
|
|
let custom_data = this.model.getCustomsDataById(this.stage_cfg.id,this.stage_cfg.order_id);
|
||
|
|
if(!custom_data)return;
|
||
|
|
let star_info = custom_data.star_info;
|
||
|
|
let con_info = this.stage_cfg.cond_info;
|
||
|
|
for(let i = 0;i < star_info.length;i++){
|
||
|
|
let con_cfg = game.configs.dungeon_heaven_data.data_star_cond[con_info[i][1]];
|
||
|
|
let 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(){
|
||
|
|
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"));
|
||
|
|
}
|
||
|
|
let list = [];
|
||
|
|
if(this.is_pass){
|
||
|
|
list = this.stage_cfg.show_award;
|
||
|
|
}else{
|
||
|
|
list = this.stage_cfg.f_show_award;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.awardLay.rebuild(list);
|
||
|
|
},
|
||
|
|
|
||
|
|
updateMonster(){
|
||
|
|
let team_num = this.stage_cfg.unit_id.length;
|
||
|
|
if(team_num > 1){
|
||
|
|
this.is_double = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
for(let index = 0;index < team_num;index++){
|
||
|
|
let unit_data = Utils.getUnitConfig(this.stage_cfg.unit_id[index]);
|
||
|
|
let list = [];
|
||
|
|
for(let i=1;i<=5;i++){
|
||
|
|
let mons_id = unit_data["monster"+i];
|
||
|
|
let cfg = Utils.getUnitConfig(mons_id);
|
||
|
|
if(cfg){
|
||
|
|
let 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(){
|
||
|
|
this.monsterInfo.active = !this.monsterInfo.active;
|
||
|
|
if(this.is_double){
|
||
|
|
this.monsterInfo2.active = !this.monsterInfo2.active;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
clickFightClear(){
|
||
|
|
this.ctrl.checkHeavenSweep(this.stage_cfg.id,this.stage_cfg.order_id);
|
||
|
|
},
|
||
|
|
|
||
|
|
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) {},
|
||
|
|
});
|