You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.3 KiB
62 lines
2.3 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, SpriteFrame } from "cc";
|
|
import UIParse from "../../Mgr_UI/UIParse";
|
|
import { TrialRankData } from "../../const/GameInterface";
|
|
import { Global } from "../../Global";
|
|
import { MainConfig } from "db://assets/Launch/_MainConfig";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("hurtrankitem_Proxy")
|
|
export default class hurtrankitem_Proxy extends UIParse{
|
|
//#region 节点自动生成
|
|
|
|
@property(Sprite)
|
|
spr_bg: Sprite = null;
|
|
@property(Sprite)
|
|
spr_rankbg: Sprite = null;
|
|
@property(Label)
|
|
lab_rank: Label = null;
|
|
@property(Sprite)
|
|
spr_icon: Sprite = null;
|
|
@property(Label)
|
|
lab_name: Label = null;
|
|
@property(Label)
|
|
lab_hurt: Label = null;
|
|
//#endregion 节点自动生成
|
|
|
|
@property({type:[SpriteFrame]})
|
|
protected mBgs: SpriteFrame[] = [];
|
|
@property({type:[SpriteFrame]})
|
|
protected mRankBgs: SpriteFrame[] = [];
|
|
onButtonClick(button:Button){
|
|
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
|
|
setInfo(rank:number, info:TrialRankData){
|
|
if(rank < 4){
|
|
this.spr_bg.spriteFrame = this.mBgs[rank - 1];
|
|
this.spr_rankbg.spriteFrame = this.mRankBgs[rank - 1];
|
|
CNodeUtils.switchText(this.lab_rank, "");
|
|
}else{
|
|
this.spr_bg.spriteFrame = this.mBgs[3];
|
|
this.spr_rankbg.spriteFrame = null;
|
|
CNodeUtils.switchText(this.lab_rank, rank.toString());
|
|
}
|
|
// if(rank < 3){
|
|
// }else{
|
|
// }
|
|
if(!info.isPlayer){
|
|
const agent = Global.CsvMgr.Agent_csv[info.idx];
|
|
CNodeUtils.switchText(this.lab_name, agent.name_cn);
|
|
}else{
|
|
CNodeUtils.switchText(this.lab_name, (MainConfig.UserInfo.nick_name && MainConfig.UserInfo.nick_name.length > 0)? MainConfig.UserInfo.nick_name : "自己");
|
|
}
|
|
CNodeUtils.switchText(this.lab_hurt, info.damage.toString());
|
|
}
|
|
}
|