toast.ts 448 B

123456789101112131415161718
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('toast')
  4. export class toast extends Component {
  5. @property(Node) lab_name:Node = null;
  6. remove_self(){
  7. // console.log("remove_self")
  8. this.node.removeFromParent();
  9. }
  10. public showView(text:string){
  11. if(this.lab_name!=null){
  12. this.lab_name.getComponent(Label).string = text;
  13. }
  14. }
  15. }