41 lines
871 B
JavaScript
41 lines
871 B
JavaScript
|
import GameModel from "../ts/core/GameModel";
|
||
|
import GameUtil from "../ts/core/GameUtil";
|
||
|
|
||
|
cc.Class({
|
||
|
extends: cc.Component,
|
||
|
|
||
|
properties: {
|
||
|
nameLab: cc.Label,
|
||
|
levelLab: cc.Label,
|
||
|
headIcon: cc.Sprite,
|
||
|
raceNodes: [cc.Node],
|
||
|
},
|
||
|
|
||
|
onLoad() {
|
||
|
|
||
|
},
|
||
|
|
||
|
loadInfo(info) {
|
||
|
this.id = info.roleid;
|
||
|
this.nameLab.string = info.name;
|
||
|
if(info.level == -1){
|
||
|
this.levelLab.string = '離線';
|
||
|
this.levelLab.node.color = cc.color(255,0,0);
|
||
|
}else{
|
||
|
this.levelLab.string = info.level + '級';
|
||
|
this.levelLab.node.color = GameUtil.getReliveColor(info.relive);
|
||
|
}
|
||
|
if(info.race != 0){
|
||
|
this.raceNodes[parseInt(info.race)-1].active = true;
|
||
|
}
|
||
|
this.headIcon.spriteFrame = GameModel.getRoleHead(info.resid);
|
||
|
},
|
||
|
|
||
|
onButtonClick(event, param) {
|
||
|
if (this.setSearchId) {
|
||
|
this.setSearchId(this.id, this.nameLab.string);
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
|