12345678910111213141516171819202122 |
- import { _decorator, Animation, Component, Label } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('Tip')
- export class Tip extends Component {
- private _animation: Animation = null;
- protected onLoad(): void {
- this._animation = this.node.getComponent(Animation);
- }
- start() {
- this._animation.once(Animation.EventType.FINISHED,()=>{
- this.node.removeFromParent();
- this.node.destroy();
- })
- }
- setContent(content: string){
- this.node.getComponent(Label).string = content;
- }
- }
|