import { _decorator, Component, Node, Sprite } from 'cc'; import { resMgr } from '../../Frames/ResourcesMgr'; const { ccclass, property } = _decorator; @ccclass('Card') export class Card extends Component { private _lock: Node = null; private _label: Node = null; private _sprite: Node = null; protected onLoad(): void { this._lock = this.node.getChildByName("Lock"); this._label = this.node.getChildByName("Label"); this._sprite = this.node.getChildByName("Sprite") } start() { } setLock(b: boolean){ this._lock.active = b; } setlabel(b: boolean){ this._label.active = b; } setSprite(name: string){ this._sprite.getComponent(Sprite).spriteFrame = resMgr.getSpriteFrame(name); } }