const ItemBase = require("nx.fx.sv.expand.item"); const CampfightMod = require("campfight.mod"); const RCT = require("role_controller"); // const BCT = require("battle_controller"); // const BCS = require("battle_const"); const HeroConst = require("hero_const"); const HeroController = require("hero_controller"); const PartnerConst = require("partner_const"); cc.Class({ extends: ItemBase, properties: { normal:{ default:null, type:cc.Node }, pname:{ default:null, type:cc.Node }, smNd:{ default:null, type:cc.Node }, fabSmod:{ default:null, type:cc.Prefab } }, rebind(_index,_data,_key){ this._super(_index,_data,_key); this.setData(_data); }, setData(data){ if(nx.dt.objEmpty(data)){ return; } this.setEmpty(); this.data = data; //是否參賽 let is_contest = CampfightMod.getInstance().isContest(); if(is_contest){ let myRole = RCT.getInstance().getRoleVo(); if(myRole.rid == data.rid && myRole.srv_id == data.srv_id){ nx.gui.setActive(this,"bat",false); nx.gui.setActive(this,"like",false); }else{ nx.gui.setActive(this,"bat",true); nx.gui.setActive(this,"like",true); nx.gui.setString(this,"like/bg/num",data.worship_num); } }else{//不参赛 nx.gui.setActive(this,"bat",false); nx.gui.setActive(this,"like",false); } //信息 nx.gui.setString(this.pname,"txt",data.name); nx.gui.setString(this.pname,"power",data.power); if(data.rank > 3){ nx.gui.setActive(this,"4",true); nx.gui.setActive(this.normal,"",true); let ico_path = cc.js.formatStr("prefab/pvp/campfighting/ui/rank_%s",data.rank); nx.gui.setSpriteFrame(this.normal,"ico",ico_path); }else{ nx.gui.setActive(this,String(data.rank),true); } //人物模型 if(!this.smod){ this.smod = cc.instantiate(this.fabSmod); this.smod.parent = this.smNd; if(data.rank > 3){ this.smod.scale = 0.9; } } let cmp = nx.gui.getComponent(this.smod,"","cmp.partner.smod"); if(cmp){ cmp.setData(data.lookid,true,false); } }, setEmpty(){ this.normal.active = false; for(let i=1;i<=4;i++){ nx.gui.setActive(this,String(i),false); } }, onClickBat(){ if(this.data){ HeroController.getInstance().openFormGoFightPanel(true, PartnerConst.Fun_Form.YearCross, {period:CampfightMod.getInstance().getCurPeriod(),need_hide_top:true,bat_data:this.data}, HeroConst.FormShowType.eFormFight) // BCT.getInstance().requestOpenBattleRelevanceWindow(BCS.Fight_Type.newYearCross,null,(_data)=>{ // if(_data){ // CampfightMod.getInstance().reqBat(this.data.rid, this.data.srv_id); // } // }); } }, onWorshOne(){ RCT.getInstance().sender10316(this.data.rid,this.data.srv_id,this.data.rank,9); CampfightMod.getInstance().reqBatGroup(CampfightMod.getInstance().getReqGroup()); }, });