81 lines
2.0 KiB
JavaScript
81 lines
2.0 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'dd51fqmla9JF4C6CzPgbhbs', 'cmp.planesafk.wnd.hire');
|
||
|
|
// Scripts/mod/pve/planesafk/cmp/cmp.planesafk.wnd.hire.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var BridgeWindow = require("bridge.window");
|
||
|
|
var NxExpand = require("nx.fx.sv.expand");
|
||
|
|
var PlanesafkController = require("planesafk_controller");
|
||
|
|
var PlanesafkConst = require("planesafk_const");
|
||
|
|
|
||
|
|
//复活和回血事件
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeWindow,
|
||
|
|
properties: {
|
||
|
|
list: {
|
||
|
|
"default": null,
|
||
|
|
type: NxExpand
|
||
|
|
},
|
||
|
|
btn_sure: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
this.ctrl = PlanesafkController.getInstance();
|
||
|
|
this.model = this.ctrl.getModel();
|
||
|
|
},
|
||
|
|
start: function start() {},
|
||
|
|
onOpenConfigs: function onOpenConfigs(data) {
|
||
|
|
this.data = data;
|
||
|
|
var hero_list = data.planes_load_partner;
|
||
|
|
if (!hero_list) return;
|
||
|
|
this.setData(hero_list);
|
||
|
|
var evt_data = this.ctrl.getMapEvtData(this.data.line, this.data.index);
|
||
|
|
if (evt_data && evt_data.is_black) {
|
||
|
|
this.btn_sure.active = false;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setData: function setData(hero_list) {
|
||
|
|
this.list.rebuild(hero_list);
|
||
|
|
},
|
||
|
|
onPreClosed: function onPreClosed() {
|
||
|
|
this.list.rebuild([]);
|
||
|
|
},
|
||
|
|
// 选中切换
|
||
|
|
onFocusChanged: function onFocusChanged(_item) {
|
||
|
|
// 空
|
||
|
|
if (nx.dt.objEmpty(_item) || nx.dt.objEmpty(_item.mdata)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 聚焦
|
||
|
|
this.list.cleanFocus();
|
||
|
|
this.list.addFocus(_item.index);
|
||
|
|
this.cur_item = _item;
|
||
|
|
},
|
||
|
|
onClickSureBtn: function onClickSureBtn() {
|
||
|
|
if (!this.data) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (this.cur_item) {
|
||
|
|
var pos = this.cur_item.mdata.pos;
|
||
|
|
if (pos) {
|
||
|
|
this.ctrl.sender28600(this.data.line, this.data.index, 1, [{
|
||
|
|
type: PlanesafkConst.Proto_28600._9,
|
||
|
|
val1: pos,
|
||
|
|
val2: 0
|
||
|
|
}]);
|
||
|
|
}
|
||
|
|
this.ctrl.openPlanesafkHireHeroWindow(false);
|
||
|
|
} else {
|
||
|
|
nx.tbox("msg_planesafk_choose_hrie_hero");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// update (dt) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|