155 lines
4.6 KiB
JavaScript
155 lines
4.6 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'e8027OAG91CWovgDVRzvf8/', 'cmp.planesafk.wnd.evt');
|
||
|
|
// Scripts/mod/pve/planesafk/cmp/cmp.planesafk.wnd.evt.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var BridgeWindow = require("bridge.window");
|
||
|
|
var NxExpand = require("nx.fx.sv.expand");
|
||
|
|
var PlanesafkController = require("planesafk_controller");
|
||
|
|
var PlanesafkEvent = require("planesafk_event");
|
||
|
|
var PlanesafkConst = require("planesafk_const");
|
||
|
|
|
||
|
|
//复活和回血事件
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeWindow,
|
||
|
|
properties: {
|
||
|
|
list: {
|
||
|
|
"default": null,
|
||
|
|
type: NxExpand
|
||
|
|
},
|
||
|
|
btn_comfirm: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
title_txt: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Label
|
||
|
|
},
|
||
|
|
desc: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.RichText
|
||
|
|
},
|
||
|
|
ico: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
title_bg: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
this.ctrl = PlanesafkController.getInstance();
|
||
|
|
this.model = this.ctrl.getModel();
|
||
|
|
this.bindGEvent(PlanesafkEvent.Get_Hero_Live_Event, this.getLiveHero.bind(this));
|
||
|
|
this.bindGEvent(PlanesafkEvent.Look_Other_Hero_Event, this.lookOtherHero.bind(this));
|
||
|
|
},
|
||
|
|
getLiveHero: function getLiveHero() {
|
||
|
|
var list = this.model.getAllPlanesHeroData();
|
||
|
|
list.sort(Utils.tableLowerSorter(["hp_per"]));
|
||
|
|
this.setListData(list);
|
||
|
|
},
|
||
|
|
lookOtherHero: function lookOtherHero(data) {
|
||
|
|
if (!data) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
;
|
||
|
|
this.is_ther_send = false;
|
||
|
|
this.dic_other_hero[data.pos] = data;
|
||
|
|
},
|
||
|
|
start: function start() {},
|
||
|
|
onOpenConfigs: function onOpenConfigs(param) {
|
||
|
|
this.board_id = param.id;
|
||
|
|
this.data = param.data;
|
||
|
|
var setting = param.setting || {};
|
||
|
|
this.board_cfg = setting.board_cfg;
|
||
|
|
this.setData(param.id);
|
||
|
|
var list = this.model.getAllPlanesHeroData();
|
||
|
|
if (list == null) {
|
||
|
|
this.ctrl.sender28613();
|
||
|
|
} else {
|
||
|
|
list.sort(Utils.tableLowerSorter(["hp_per"]));
|
||
|
|
this.setListData(list);
|
||
|
|
}
|
||
|
|
var evt_data = this.ctrl.getMapEvtData(this.data.line, this.data.index);
|
||
|
|
if (evt_data && evt_data.is_black) {
|
||
|
|
this.btn_comfirm.active = false;
|
||
|
|
}
|
||
|
|
var path = null;
|
||
|
|
if (this.board_id == PlanesafkConst.Recover_Id) {
|
||
|
|
path = cc.path.join("prefab/pve/planesafk/ui", "bg_event_blue");
|
||
|
|
} else if (this.board_id == PlanesafkConst.Revive_Id) {
|
||
|
|
path = cc.path.join("prefab/pve/planesafk/ui", "bg_event_puple");
|
||
|
|
}
|
||
|
|
if (path != null) {
|
||
|
|
nx.gui.setSpriteFrame(this.title_bg, path);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setListData: function setListData(list) {
|
||
|
|
this.hero_list = list;
|
||
|
|
this.list.rebuild(this.hero_list);
|
||
|
|
},
|
||
|
|
setData: function setData(id) {
|
||
|
|
if (!id) return;
|
||
|
|
var board_cfg = this.board_cfg;
|
||
|
|
if (nx.dt.objEmpty(board_cfg)) {
|
||
|
|
//避免报错的
|
||
|
|
board_cfg = game.configs.SecretDunData.data_board[id];
|
||
|
|
}
|
||
|
|
if (!board_cfg) return;
|
||
|
|
|
||
|
|
// 按钮
|
||
|
|
if (board_cfg.btn_str != "") {
|
||
|
|
this.btn_comfirm.active = true;
|
||
|
|
nx.gui.setString(this.btn_comfirm, "txt", board_cfg.btn_str);
|
||
|
|
} else {
|
||
|
|
this.btn_comfirm.active = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 图片
|
||
|
|
|
||
|
|
// 标题
|
||
|
|
this.title_txt.string = board_cfg.title;
|
||
|
|
|
||
|
|
// 描述内容一
|
||
|
|
this.desc.string = board_cfg.desc_1;
|
||
|
|
},
|
||
|
|
onPreClosed: function onPreClosed() {
|
||
|
|
this.list.rebuild([]);
|
||
|
|
},
|
||
|
|
onClickComfirmBtn: function onClickComfirmBtn() {
|
||
|
|
if (!this.board_id || !this.data) return;
|
||
|
|
var self = this;
|
||
|
|
// 告示牌和升降台无需操作
|
||
|
|
if (this.board_id == PlanesafkConst.Recover_Id || this.board_id == PlanesafkConst.Revive_Id) {
|
||
|
|
if (this.board_id == PlanesafkConst.Recover_Id && !this.model.checkIsHaveHpNotFullHero()) {
|
||
|
|
// 回复泉水时,所有英雄都是满血
|
||
|
|
nx.mbox(nx.text.getKey("msg_planesafk_reply_tip"), ["cancel", "confirm"], function (_key, _box) {
|
||
|
|
_box.close();
|
||
|
|
if (_key == "confirm") {
|
||
|
|
self.ctrl.sender28600(self.data.line, self.data.index, 1, {});
|
||
|
|
self.ctrl.openPlanesafkBoardWindow(false);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
} else if (this.board_id == PlanesafkConst.Revive_Id && !this.model.checkIsHaveDieHero()) {
|
||
|
|
// 复活时,没有死亡的英雄
|
||
|
|
nx.mbox(nx.text.getKey("msg_planesafk_death_tip"), ["cancel", "confirm"], function (_key, _box) {
|
||
|
|
_box.close();
|
||
|
|
if (_key == "confirm") {
|
||
|
|
self.ctrl.sender28600(self.data.line, self.data.index, 1, {});
|
||
|
|
self.ctrl.openPlanesafkBoardWindow(false);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
this.ctrl.sender28600(this.data.line, this.data.index, 1, {});
|
||
|
|
this.ctrl.openPlanesafkBoardWindow(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// update (dt) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|