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); } }