first commit
This commit is contained in:
16
assets/scripts/utils/Toast.ts
Normal file
16
assets/scripts/utils/Toast.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user