"use strict"; cc._RF.push(module, '0866aQ99OJI14MqDFBgy4jp', 'cmp.planesafk.wnd.herolist'); // Scripts/mod/pve/planesafk/cmp/cmp.planesafk.wnd.herolist.js "use strict"; var BridgeWindow = require("bridge.window"); var NxExpand = require("nx.fx.sv.expand"); var PlanesafkController = require("planesafk_controller"); var HeroController = require("hero_controller"); var PlanesafkEvent = require("planesafk_event"); var TipsController = require("tips_controller"); cc.Class({ "extends": BridgeWindow, properties: { list: { "default": null, type: NxExpand } }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() { this.ctrl = PlanesafkController.getInstance(); this.model = this.ctrl.getModel(); this.dic_other_hero = []; this.is_ther_send = false; this.bindGEvent(PlanesafkEvent.Get_All_Hero_Event, this.getAllHeroList.bind(this)); this.bindGEvent(PlanesafkEvent.Look_Other_Hero_Event, this.lookOther.bind(this)); }, lookOther: function lookOther(data) { if (!data) return; this.is_ther_send = false; this.dic_other_hero[data.pos] = data; }, getAllHeroList: function getAllHeroList() { var list = this.model.getAllPlanesHeroData(); list.sort(Utils.tableUpperSorter(["star", "lev", "flag"])); list.sort(Utils.tableLowerSorter(["hp_per"])); this.setData(list); }, start: function start() {}, onOpenConfigs: function onOpenConfigs(param) { var list = this.model.getAllPlanesHeroData(); if (list == null) { this.ctrl.sender28613(); } else { list.sort(Utils.tableUpperSorter(["star", "lev", "flag"])); list.sort(Utils.tableLowerSorter(["hp_per"])); this.setData(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); var hero_vo = _item.mdata; if (hero_vo) { if (hero_vo.flag == 0) { var new_hero_vo = HeroController.getInstance().getModel().getHeroById(hero_vo.partner_id); if (new_hero_vo) { TipsController.getInstance().showPartnerTips(new_hero_vo); // HeroController.getInstance().openHeroTipsPanel(true, new_hero_vo,null,false) } else { nx.tbox("lab_planesafk_comefrom"); } } else { if (this.dic_other_hero[hero_vo.partner_id]) { TipsController.getInstance().showPartnerTips(this.dic_other_hero[hero_vo.partner_id]); // HeroController.getInstance().openHeroTipsPanel(true, this.dic_other_hero[hero_vo.partner_id],null,false) } else { if (this.is_ther_send) return; this.is_ther_send = true; this.ctrl.sender28623(hero_vo.partner_id); } } } }, setData: function setData(list) { this.hero_list = list || []; this.list.rebuild(this.hero_list); } // update (dt) {}, }); cc._RF.pop();