refactor(config,map): 统一抽离卡片背景颜色配置
将多处硬编码的卡片等级背景颜色数组移至公共配置文件, 同时重构英雄列表组件的等级显示逻辑,替换为标签直接赋值。
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import { _decorator, Component } from "cc";
|
||||
import { CARD_LV_BG_COLORS } from "../common/config/GameSet";
|
||||
|
||||
const { ccclass } = _decorator;
|
||||
|
||||
const POOL_COLORS = ["green", "blue", "purple", "yellow", "red"];
|
||||
|
||||
@ccclass('CardBgComp')
|
||||
export class CardBgComp extends Component {
|
||||
|
||||
apply(poolLv: number) {
|
||||
const color = POOL_COLORS[Math.min(poolLv, 5) - 1];
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user