"use strict"; cc._RF.push(module, '08ea70H9fhABLgD508gQw1U', 'cmp.pvp.ladder.challenge'); // Scripts/mod/pvp/ladder/cmp/cmp.pvp.ladder.challenge.js "use strict"; var BridgeWindow = require("bridge.window"); var LadderController = require("ladder_controller"); var HeroVo = require("hero_vo"); var HeroController = require("hero_controller"); //查看好友 cc.Class({ "extends": BridgeWindow, properties: { nodBaseInfo: { "default": null, type: cc.Node }, nodPartner: { "default": null, type: cc.Node }, nodPower: { "default": null, type: cc.Node }, nodAvatar: { "default": null, type: cc.Node }, nodUID: { "default": null, type: cc.Node }, nodSRV: { "default": null, type: cc.Node } }, // LIFE-CYCLE CALLBACKS: onPreClosed: function onPreClosed() {}, /**** * {"rid":990,"srv_id":"robot","name":"以蕊以寒","lev":60,"vip_lev":0,"face":10403,"sex":1,"power":104180,"rank":990,"gname":"","avatar_id":0,"formation_type":1,"formation_lev":0, * "p_list":[{"pos":1,"id":1,"bid":40505,"lev":100,"quality":0,"star":5,"is_robot":1},{"pos":2,"id":2,"bid":30505,"lev":100,"quality":0,"star":5,"is_robot":1},{"pos":3,"id":3,"bid":20503,"lev":100,"quality":0,"star":5,"is_robot":1},{"pos":4,"id":4,"bid":10507,"lev":100,"quality":0,"star":5,"is_robot":1},{"pos":5,"id":5,"bid":50504,"lev":100,"quality":0,"star":5,"is_robot":1}],"face_update_time":0,"face_file":""} */ onOpenConfigs: function onOpenConfigs(_params) { this.fightData = _params; nx.gui.hideAllChildren(this.nodPartner); this.freshBaseInfo(); this.freshPartnerInfo(); }, // 刷新基本信息 freshBaseInfo: function freshBaseInfo() { nx.gui.setString(this.nodBaseInfo, "top/name", this.fightData.name); nx.gui.setString(this.nodBaseInfo, "top/vip/CusNum", this.fightData.vip_lev); nx.gui.setString(this.nodBaseInfo, "info_lay/rank/txt", this.fightData.rank); nx.gui.setString(this.nodUID, "", this.fightData.rid); var sid = this.fightData.srv_id.split("_"); nx.gui.setString(this.nodSRV, "", this.fightData.srv_id == "robot" ? "[" + nx.text.format("Srever", 1) + "]" : "[" + nx.text.format("Srever", sid[1]) + "]"); nx.gui.setString(this.nodBaseInfo, "info_lay/guild/txt", this.fightData.gname); nx.gui.setString(this.nodPower, "", this.fightData.power); var avtar = nx.gui.getComponent(this.nodAvatar, "", "cmp.common.header"); if (avtar) { avtar.setData(this.fightData); } }, // 刷新伙伴列表 freshPartnerInfo: function freshPartnerInfo() { nx.gui.gocChildren(this.nodPartner, "", this.fightData.p_list.length); var temp = []; for (var k in this.fightData.p_list) { var v = this.fightData.p_list[k]; var vo = new HeroVo(); vo.updateHeroVo(v); temp.push(vo); } var chd = this.nodPartner.children; for (var i = 0; i < chd.length; i++) { var nod = chd[i]; var dat = temp[i]; if (!dat) { nx.gui.setActive(nod, "", false); continue; } nx.gui.setActive(nod, "", true); var cmp = nod.getComponent("cmp.item.base"); //{"pos":1,"id":1,"bid":40505,"lev":100,"quality":0,"star":5,"is_robot":1} var datac = nx.dt.objClone(dat); var pfg = game.configs.partner_data.data_partner_base[dat.bid]; datac.camp_type = pfg.camp_type; datac.rrid = nx.dt.objClone(this.fightData.rid); datac.srv_idd = nx.dt.objClone(this.fightData.srv_id); if (cmp) { cmp.setData(datac); // cmp.setCids( datac ); } } }, onTouchChallenge: function onTouchChallenge() { var self = this; // let LC = LadderController.getInstance(); var fightinfo = { rid: this.fightData.rid, srv_id: this.fightData.srv_id }; // LC.requestChallengeEnemy( this.fightData.rid, this.fightData.srv_id ); HeroController.getInstance().openFormGoFightPanel(true, 9, { fight: fightinfo // cb : LC.requestChallengeEnemy( this.fightData.rid, this.fightData.srv_id ), }, 1); self.close(); } }); cc._RF.pop();