guideView.ts 806 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import Main from "../game/Main";
  2. const {ccclass, property} = cc._decorator;
  3. @ccclass
  4. export default class guideView extends cc.Component {
  5. @property(cc.Label)
  6. private lbTip: cc.Label = null;
  7. // LIFE-CYCLE CALLBACKS:
  8. onLoad () {
  9. // this.hide();
  10. }
  11. // update (dt) {}
  12. public show(str: string, delTime: number = undefined, call = undefined) {
  13. let me = this;
  14. this.lbTip.string = str;
  15. this.node.active = true;
  16. if (delTime) {
  17. setTimeout(() => {
  18. me.hide();
  19. if (call) {
  20. call();
  21. }
  22. }, delTime*1000);
  23. }
  24. Main.Ins.pauseGame();
  25. }
  26. public hide(){
  27. this.node.active = false;
  28. Main.Ins.resumeGame();
  29. }
  30. }