PropIntroduceNode.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. const {ccclass, property} = cc._decorator;
  8. @ccclass
  9. export default class PropIntroduceNode extends cc.Component {
  10. @property(cc.Label)
  11. nameLabel: cc.Label = null;
  12. @property(cc.Label)
  13. descLabel: cc.Label = null;
  14. // LIFE-CYCLE CALLBACKS:
  15. // onLoad () {}
  16. start () {
  17. }
  18. initView(name:string,desc:string){
  19. if(cc.isValid(this.nameLabel)){
  20. this.nameLabel.string = name
  21. }
  22. if(cc.isValid(this.descLabel)){
  23. this.descLabel.string = desc
  24. }
  25. this.scheduleOnce(()=>{
  26. if(cc.isValid(this.node)){
  27. this.node.destroy()
  28. }
  29. },1.2)
  30. }
  31. // update (dt) {}
  32. }