SamsaraGame/assets/Script/game/MainUITeamItem.js

56 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

2025-04-24 17:03:28 +08:00
import GameModel from "../ts/core/GameModel";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let GameRes = require('./GameRes');
cc.Class({
extends: cc.Component,
properties: {
MainTeamPanel: cc.Prefab,
leave_auto: cc.SpriteFrame,
leave: cc.SpriteFrame,
leaveIcon: cc.Sprite,
border: cc.Sprite
},
setInfo(info) {
this.objInfo = info;
if (info.livingtype == 1) {
cc.find('headicon', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getRoleHead(info.resid);
var headNode = cc.find("headBorder", this.node);
var headBorderId = info.portrait ? info.portrait : 555100;
SKUIUtil.setHeadBorder(headNode, headBorderId);
// cc.find('levelback', this.node).active = false;
cc.find('Level', this.node).getComponent(cc.Label).string = info.level;
cc.find('huoban', this.node).active = false;
if (info.pause == 1) {
if (info.ischeck == 1)
this.leaveIcon.spriteFrame = this.leave_auto
else
this.leaveIcon.spriteFrame = this.leave
} else
this.leaveIcon.spriteFrame = null
}
else {
cc.find('headicon', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getHouBanHead(info.resid);
cc.find('Level', this.node).getComponent(cc.Label).string = info.level;
var headNode = cc.find("headBorder", this.node);
SKUIUtil.setHeadBorder(headNode, 0)
// cc.find('levelback', this.node).active = false;
cc.find('huoban', this.node).active = true;
this.leaveIcon.spriteFrame = null
}
},
openMemberPanel() {
if (GameModel.player.mapid == 4004) return;
if (GameModel.player.mapid == 1213) return;
if (this.objInfo.livingtype == 1) {
let memberPanel = cc.instantiate(this.MainTeamPanel);
memberPanel.parent = cc.find('Canvas');
memberPanel.getComponent('MainUITeamPanel').setInfo(this.objInfo);
}
}
});