Files
2025-11-18 18:38:53 +08:00

17 lines
450 B
TypeScript

import { _decorator, Component, Label } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('Toast')
export default class Toast extends Component {
@property(Label)
msgLabel: Label | null = null;
protected onRemove():void{
this.node.active = false;
}
public setText(text:string):void{
this.unschedule(this.onRemove);
this.schedule(this.onRemove, 2);
this.msgLabel.string = text;
}
}