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.
73 lines
3.0 KiB
73 lines
3.0 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, tween } from "cc";
|
|
import BaseUIForm from "../../Mgr_UI/BaseUIForm";
|
|
import TimeUtils from "../../ExUtils/TimeUtils";
|
|
import GDUtils from "../../ExCUtils/GDUtils";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("PopPassInfoUI_Proxy")
|
|
export default class PopPassInfoUI_Proxy extends BaseUIForm{
|
|
//#region 节点自动生成
|
|
@property(Node)
|
|
n_timeinfo: Node = null;
|
|
@property(Label)
|
|
lab_time: Label = null;
|
|
@property(Label)
|
|
lab_time_title: Label = null;
|
|
@property(Node)
|
|
n_time_star: Node = null;
|
|
@property(Node)
|
|
n_fightinfo: Node = null;
|
|
@property(Label)
|
|
lab_fight: Label = null;
|
|
@property(Label)
|
|
lab_fight_title: Label = null;
|
|
@property(Node)
|
|
n_fight_star: Node = null;
|
|
//#endregion 节点自动生成
|
|
|
|
onButtonClick(button:Button){
|
|
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
|
|
protected start(): void {
|
|
const passtime = this.mDataMgr.Pass.record_times;
|
|
CNodeUtils.switchText(this.lab_time,TimeUtils.makeTimeLeftString(passtime, "分"));
|
|
CNodeUtils.switchText(this.lab_fight, this.mDataMgr.Role.fighting);
|
|
// 时间评级
|
|
const rating = this.mDataMgr.Pass.timeRatingConfig;
|
|
// 计算时间星星数量
|
|
const timeStars = rating.starFormula(passtime);
|
|
this.createStars(this.n_time_star, timeStars, rating.starLevel);
|
|
this.lab_time_title.color = this.lab_time_title.color.fromHEX(GDUtils.GetQualityColorHEX(rating.starLevel));
|
|
CNodeUtils.switchText(this.lab_time_title, rating.title);
|
|
|
|
// 战力评级
|
|
const fightingRating = this.mDataMgr.Pass.fightingRatingConfig;
|
|
// 计算战力星星数量
|
|
const fightStars = fightingRating.starFormula(this.mDataMgr.Role.fighting);
|
|
this.createStars(this.n_fight_star, fightStars, fightingRating.starLevel);
|
|
this.lab_fight_title.color = this.lab_fight_title.color.fromHEX(GDUtils.GetQualityColorHEX(fightingRating.starLevel));
|
|
CNodeUtils.switchText(this.lab_fight_title, fightingRating.title);
|
|
}
|
|
|
|
|
|
private createStars(tNode: Node, starCount: number, starLevel: number) {
|
|
// 限制星星数量不超过5个
|
|
starCount = Math.min(starCount, 5);
|
|
for (let i = 0; i < tNode.children.length; i++) {
|
|
let star = tNode.children[i];
|
|
CNodeUtils.setActive(star, i < starCount);
|
|
if(i < starCount){
|
|
let starIcon:Sprite = star.getComponent(Sprite);
|
|
starIcon.color = GDUtils.GetQualityColor(starLevel);
|
|
}
|
|
}
|
|
}
|
|
}
|