Files
fc/dev/project/assets/Scripts/mod/pve/planesafk/cmp/cmp.planesafk.wnd.hire.js
T

84 lines
1.9 KiB
JavaScript
Raw Normal View History

2026-05-23 22:10:14 +08:00
const BridgeWindow = require("bridge.window");
const NxExpand = require("nx.fx.sv.expand");
const PlanesafkController = require("planesafk_controller");
const 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() {
this.ctrl = PlanesafkController.getInstance();
this.model = this.ctrl.getModel();
},
start() {
},
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( hero_list ){
this.list.rebuild(hero_list);
},
onPreClosed() {
this.list.rebuild([]);
},
// 选中切换
onFocusChanged: function( _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( ){
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) {},
});