"use strict"; cc._RF.push(module, 'a7a56Z1IpRCfbiPlqkv2Yn1', 'cmp.battledrama.bossinfo'); // Scripts/mod/battle_drama/cmp/cmp.battledrama.bossinfo.js "use strict"; var BridgeWindow = require("bridge.window"); var NxSpine = require("nx.fx.spine"); // const HeroController = require("hero_controller"); // const HeroConst = require("hero_const"); var 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: function 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: function start() {}, // 重载:关闭前 onPreClosed: function onPreClosed() { 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: function onOpenConfigs(params) { var _this = this; if (nx.dt.objEmpty(params)) { return; } this.dun_id = params.dun_id; this.enterSp.node.active = true; var res_path = PathTool.getSpinePath("E80036", "E80036", false); this.enterSp.load(res_path, function (_e) { if (!_e) { _this.enterSp.action("action", false, function (_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: function doBossAct() { var _this2 = this; this.bossSp.node.active = true; this.bossSp.action("action", false, function (_key, _name) { if (_key == "start") { var data = game.configs.drama_story_data.data_get[_this2.dun_id]; _this2.boss_name.string = data.name; //英雄立繪 var partner_cfg = game.configs.partner_data.data_partner_base[data.id]; if (nx.dt.objEmpty(partner_cfg)) { return; } var res_path = PathTool.getSpinePath(partner_cfg.bustid, "show", false); _this2.role.load(res_path, function (_e) { if (!_e) { _this2.role.action("drama1", true); } else { _this2.role.stop(); } }); //章節相關信息 var dungeon_cfg = game.configs.dungeon_data.data_drama_dungeon_info[_this2.dun_id]; _this2.chaptor_name.string = dungeon_cfg.chapter_id + nx.text.getKey("battle_str14"); _this2.dungeon_name.string = nx.text.getKey("battle_str15") + dungeon_cfg.name; var story_cfg = game.configs.dungeon_data.data_drama_boss_desc[_this2.dun_id]; _this2.boss_desc.string = story_cfg.desc; return; } if (_key == "complete") { _this2.is_allow_close = true; _this2.bossSp.action("action2", true); _this2.nodBtn.active = true; return; } }); }, tryClose: function tryClose() { var _this3 = this; if (!this.is_allow_close) return; this.tryPlot(function (_event) { if (_event != "start") { // 出击 _this3.close(); BTD.getInstance().send13003(0); return; } }); }, // 尝试出击前剧情触发 // ingore: 未触发剧情,可直接进入战斗 // start: 成功触发剧情,等待结束 // done: 剧情触发完毕 tryPlot: function tryPlot(_cb) { nx.debug("$Plot:进入编队界面,剧情触发检查..."); // 未开启引导 if (!nx.bridge.plot) { nx.dt.fnInvoke(_cb, 'ingore'); return; } // 进行中 var cur = nx.bridge.plot.vget("id"); if (nx.dt.strNEmpty(cur)) { nx.dt.fnInvoke(_cb, 'ingore'); return; } // 逐个触发 var queue = nx.dt.objClone(nx.bridge.plot.configs.base.drama_team); var check = function check() { // 检查完毕 if (nx.dt.arrEmpty(queue)) { nx.dt.fnInvoke(_cb, 'ingore'); return; } // 尝试触发 var ok = nx.bridge.plot.fire(queue.shift(), function (_ret, _data) { // 未触发 if (!_ret) { check(); return; } // 引导完成 nx.dt.fnInvoke(_cb, 'done'); }); // 触发成功 if (ok) { nx.dt.fnInvoke(_cb, 'start'); } }; check(); } // update (dt) {}, }); cc._RF.pop();