const BridgeWindow = require("bridge.window"); const LadderController = require( "ladder_controller" ); const HeroVo = require("hero_vo"); const 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( ){ }, /**** * {"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 ( _params ){ this.fightData = _params; nx.gui.hideAllChildren( this.nodPartner ); this.freshBaseInfo(); this.freshPartnerInfo(); }, // 刷新基本信息 freshBaseInfo: function(){ 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 ); let 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 ); let avtar = nx.gui.getComponent( this.nodAvatar, "", "cmp.common.header" ); if( avtar ){ avtar.setData( this.fightData ); } }, // 刷新伙伴列表 freshPartnerInfo: function(){ nx.gui.gocChildren( this.nodPartner, "", this.fightData.p_list.length ); let temp = []; for ( let k in this.fightData.p_list) { let v = this.fightData.p_list[k]; let vo = new HeroVo(); vo.updateHeroVo(v); temp.push(vo); } let chd = this.nodPartner.children; for (let i = 0; i < chd.length; i++) { let nod = chd[i]; let dat = temp[i]; if( !dat ){ nx.gui.setActive( nod, "", false ); continue; } nx.gui.setActive( nod, "", true ); let cmp = nod.getComponent( "cmp.item.base" ); //{"pos":1,"id":1,"bid":40505,"lev":100,"quality":0,"star":5,"is_robot":1} let datac = nx.dt.objClone( dat ); let 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(){ let self = this; // let LC = LadderController.getInstance(); let 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(); }, });