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