213 lines
5.8 KiB
JavaScript
213 lines
5.8 KiB
JavaScript
const BridgeWindow = require("bridge.window")
|
|
const NxSpine = require("nx.fx.spine");
|
|
// const HeroController = require("hero_controller");
|
|
// const HeroConst = require("hero_const");
|
|
const BTD = require( "battle_drama_controller" );
|
|
cc.Class({
|
|
extends: BridgeWindow,
|
|
|
|
properties: {
|
|
enterSp:{
|
|
default:null,
|
|
type:NxSpine
|
|
},
|
|
bossSp:{
|
|
default:null,
|
|
type:NxSpine
|
|
},
|
|
chaptor_name:{
|
|
default:null,
|
|
type:cc.Label
|
|
},
|
|
dungeon_name:{
|
|
default:null,
|
|
type:cc.Label
|
|
},
|
|
boss_desc:{
|
|
default:null,
|
|
type:cc.Label
|
|
},
|
|
boss_name:{
|
|
default:null,
|
|
type:cc.Label
|
|
},
|
|
role:{
|
|
default:null,
|
|
type:NxSpine
|
|
},
|
|
nodMask:{
|
|
default:null,
|
|
type: cc.Node
|
|
},
|
|
nodBtn: {
|
|
default:null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
onLoad () {
|
|
this.is_allow_close = false;
|
|
if( nx.bridge.plot && nx.bridge.plot.isDoing() ){
|
|
nx.gui.setActive( this.nodMask, "", true );
|
|
}else{
|
|
nx.gui.setActive( this.nodMask, "", false );
|
|
}
|
|
this.nodBtn.active = false;
|
|
},
|
|
|
|
start () {
|
|
|
|
},
|
|
|
|
// 重载:关闭前
|
|
onPreClosed: function() {
|
|
if ( this.enterSp ) { this.enterSp.stop(); }
|
|
if ( this.bossSp ) { this.bossSp.stop(); }
|
|
if ( this.role ) { this.role.stop(); }
|
|
// HeroController.getInstance().openFormGoFightPanel(true, 0,{},HeroConst.FormShowType.eFormFight, true);//剧情限定阵容
|
|
},
|
|
|
|
// close(){
|
|
// this._super();
|
|
// },
|
|
|
|
|
|
onOpenConfigs(params){
|
|
if(nx.dt.objEmpty(params)){
|
|
return;
|
|
}
|
|
this.dun_id = params.dun_id;
|
|
this.enterSp.node.active = true;
|
|
let res_path = PathTool.getSpinePath( "E80036", "E80036", false );
|
|
this.enterSp.load( res_path, ( _e ) => {
|
|
if( !_e ) {
|
|
this.enterSp.action( "action", false,(_key,_name)=>{
|
|
if(_key == "start"){
|
|
nx.audio.playSFX("audios/effects/alarm");
|
|
return;
|
|
}
|
|
|
|
if(_key == "complete"){
|
|
this.enterSp.stop();
|
|
this.enterSp.node.active = false;
|
|
this.doBossAct();
|
|
return;
|
|
}
|
|
} );
|
|
} else {
|
|
this.enterSp.stop();
|
|
}
|
|
} );
|
|
},
|
|
|
|
doBossAct(){
|
|
this.bossSp.node.active = true;
|
|
this.bossSp.action("action",false,(_key,_name)=>{
|
|
if(_key == "start"){
|
|
let data = game.configs.drama_story_data.data_get[this.dun_id];
|
|
this.boss_name.string = data.name;
|
|
|
|
//英雄立繪
|
|
let partner_cfg = game.configs.partner_data.data_partner_base[data.id];
|
|
if(nx.dt.objEmpty(partner_cfg)){
|
|
return;
|
|
}
|
|
|
|
let res_path = PathTool.getSpinePath( partner_cfg.bustid,"show", false );
|
|
this.role.load( res_path, ( _e ) => {
|
|
if( !_e ) {
|
|
this.role.action( "drama1", true );
|
|
} else {
|
|
this.role.stop();
|
|
}
|
|
} );
|
|
|
|
//章節相關信息
|
|
let dungeon_cfg = game.configs.dungeon_data.data_drama_dungeon_info[this.dun_id];
|
|
this.chaptor_name.string = dungeon_cfg.chapter_id + nx.text.getKey("battle_str14");
|
|
this.dungeon_name.string = nx.text.getKey("battle_str15") + dungeon_cfg.name;
|
|
let story_cfg = game.configs.dungeon_data.data_drama_boss_desc[this.dun_id];
|
|
this.boss_desc.string = story_cfg.desc;
|
|
return;
|
|
}
|
|
|
|
if(_key == "complete"){
|
|
this.is_allow_close = true;
|
|
this.bossSp.action("action2",true);
|
|
this.nodBtn.active = true;
|
|
return;
|
|
}
|
|
});
|
|
},
|
|
|
|
tryClose(){
|
|
if(!this.is_allow_close)return;
|
|
this.tryPlot( _event => {
|
|
if( _event != "start" ) {
|
|
// 出击
|
|
this.close();
|
|
BTD.getInstance().send13003( 0 );
|
|
return;
|
|
}
|
|
} );
|
|
},
|
|
|
|
// 尝试出击前剧情触发
|
|
// ingore: 未触发剧情,可直接进入战斗
|
|
// start: 成功触发剧情,等待结束
|
|
// done: 剧情触发完毕
|
|
tryPlot: function( _cb ) {
|
|
|
|
nx.debug( "$Plot:进入编队界面,剧情触发检查..." );
|
|
|
|
// 未开启引导
|
|
if( !nx.bridge.plot ) {
|
|
nx.dt.fnInvoke( _cb, 'ingore' );
|
|
return;
|
|
}
|
|
|
|
// 进行中
|
|
let cur = nx.bridge.plot.vget( "id" );
|
|
if( nx.dt.strNEmpty( cur ) ) {
|
|
nx.dt.fnInvoke( _cb, 'ingore' );
|
|
return;
|
|
}
|
|
|
|
// 逐个触发
|
|
let queue = nx.dt.objClone( nx.bridge.plot.configs.base.drama_team );
|
|
let check = function() {
|
|
|
|
// 检查完毕
|
|
if( nx.dt.arrEmpty( queue ) ) {
|
|
nx.dt.fnInvoke( _cb, 'ingore' );
|
|
return;
|
|
}
|
|
|
|
// 尝试触发
|
|
let ok = nx.bridge.plot.fire( queue.shift(), ( _ret, _data ) => {
|
|
|
|
// 未触发
|
|
if( !_ret ) {
|
|
check();
|
|
return;
|
|
}
|
|
|
|
// 引导完成
|
|
nx.dt.fnInvoke( _cb, 'done' );
|
|
} );
|
|
|
|
// 触发成功
|
|
if( ok ) {
|
|
nx.dt.fnInvoke( _cb, 'start' );
|
|
}
|
|
|
|
};
|
|
check();
|
|
|
|
},
|
|
|
|
// update (dt) {},
|
|
});
|