import { _decorator, Component } from "cc"; 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]; this.node.children.forEach(c => c.active = c.name === color); } clear() { this.node.children.forEach(c => c.active = false); } }