Files
pixelheros/assets/script/game/map/CardBgComp.ts
panFD 41842f2b67 refactor(config,map): 统一抽离卡片背景颜色配置
将多处硬编码的卡片等级背景颜色数组移至公共配置文件,
同时重构英雄列表组件的等级显示逻辑,替换为标签直接赋值。
2026-08-23 23:52:20 +08:00

18 lines
462 B
TypeScript

import { _decorator, Component } from "cc";
import { CARD_LV_BG_COLORS } from "../common/config/GameSet";
const { ccclass } = _decorator;
@ccclass('CardBgComp')
export class CardBgComp extends Component {
apply(card_lv: number) {
const color = CARD_LV_BG_COLORS[Math.min(card_lv, 5) - 1];
this.node.children.forEach(c => c.active = c.name === color);
}
clear() {
this.node.children.forEach(c => c.active = false);
}
}