Files
fc/dev/project/library/imports/62/62ea5f91-63fc-4267-b107-92b7eec42c4b.js
2026-05-24 10:21:26 +08:00

113 lines
3.4 KiB
JavaScript

"use strict";
cc._RF.push(module, '62ea5+RY/xCZ7EHkrfuxCxL', 'cmp.campfight.battle.item');
// Scripts/mod/pvp/campfight/cmp/cmp.campfight.battle.item.js
"use strict";
var ItemBase = require("nx.fx.sv.expand.item");
var CampfightMod = require("campfight.mod");
var RCT = require("role_controller");
// const BCT = require("battle_controller");
// const BCS = require("battle_const");
var HeroConst = require("hero_const");
var HeroController = require("hero_controller");
var 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: function rebind(_index, _data, _key) {
this._super(_index, _data, _key);
this.setData(_data);
},
setData: function setData(data) {
if (nx.dt.objEmpty(data)) {
return;
}
this.setEmpty();
this.data = data;
//是否參賽
var is_contest = CampfightMod.getInstance().isContest();
if (is_contest) {
var 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);
var 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;
}
}
var cmp = nx.gui.getComponent(this.smod, "", "cmp.partner.smod");
if (cmp) {
cmp.setData(data.lookid, true, false);
}
},
setEmpty: function setEmpty() {
this.normal.active = false;
for (var i = 1; i <= 4; i++) {
nx.gui.setActive(this, String(i), false);
}
},
onClickBat: function 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: function onWorshOne() {
RCT.getInstance().sender10316(this.data.rid, this.data.srv_id, this.data.rank, 9);
CampfightMod.getInstance().reqBatGroup(CampfightMod.getInstance().getReqGroup());
}
});
cc._RF.pop();