66 lines
1.9 KiB
JavaScript
66 lines
1.9 KiB
JavaScript
const ItemBase = require("nx.fx.sv.expand.item");
|
|
const Itemlay = require("cmp.common.itemlayout");
|
|
const ChatController = require("chat_controller");
|
|
const RCT = require("role_controller");
|
|
const CampfightMod = require("campfight.mod");
|
|
cc.Class({
|
|
extends: ItemBase,
|
|
|
|
properties: {
|
|
awardList:{
|
|
default:null,
|
|
type:Itemlay
|
|
},
|
|
headNd:{
|
|
default:null,
|
|
type:cc.Node
|
|
},
|
|
fabHead:{
|
|
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;
|
|
nx.gui.setString(this,"name",data.name);
|
|
if(data.rank <= 3){
|
|
nx.gui.setActive(this,String(data.rank),true);
|
|
}else{
|
|
nx.gui.setActive(this,"4",true);
|
|
nx.gui.setString(this,"4/num",data.rank);
|
|
}
|
|
//頭像
|
|
if(!this.pHead){
|
|
this.pHead = cc.instantiate(this.fabHead);
|
|
this.pHead.parent = this.headNd;
|
|
}
|
|
let cmp = nx.gui.getComponent(this.pHead,"","cmp.common.header");
|
|
if(cmp){
|
|
cmp.setData(data);
|
|
cmp.addCallBack(this.touchHead.bind(this));
|
|
}
|
|
|
|
//獎勵
|
|
let period = CampfightMod.getInstance().getCurPeriod();
|
|
let infos = game.configs.arena_camp_data["data_awards"+period];
|
|
if(infos){
|
|
let award_data = infos[data.rank];
|
|
if(award_data){
|
|
this.awardList.rebuild(award_data.reward);
|
|
}
|
|
}
|
|
},
|
|
|
|
touchHead:function(){
|
|
let MyroleVo = RCT.getInstance().getRoleVo();
|
|
if(this.mdata.rid == MyroleVo.rid)return;
|
|
ChatController.getInstance().openFriendInfo({srv_id :this.mdata.srv_id, rid :this.mdata.rid,name:this.mdata.name});
|
|
},
|
|
});
|