"use strict"; cc._RF.push(module, 'c9210OM92JO+o2lTkb9l9iJ', 'cmp.campfight.award.item'); // Scripts/mod/pvp/campfight/cmp/cmp.campfight.award.item.js "use strict"; var ItemBase = require("nx.fx.sv.expand.item"); var Itemlay = require("cmp.common.itemlayout"); var ChatController = require("chat_controller"); var RCT = require("role_controller"); var 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: function rebind(_index, _data, _key) { this._super(_index, _data, _key); this.setData(_data); }, setData: function 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; } var cmp = nx.gui.getComponent(this.pHead, "", "cmp.common.header"); if (cmp) { cmp.setData(data); cmp.addCallBack(this.touchHead.bind(this)); } //獎勵 var period = CampfightMod.getInstance().getCurPeriod(); var infos = game.configs.arena_camp_data["data_awards" + period]; if (infos) { var award_data = infos[data.rank]; if (award_data) { this.awardList.rebuild(award_data.reward); } } }, touchHead: function touchHead() { var 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 }); } }); cc._RF.pop();