WaitNodeLayer.js 549 B

12345678910111213141516171819202122232425262728293031323334353637
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. },
  5. // LIFE-CYCLE CALLBACKS:
  6. // onLoad () {},
  7. start () {
  8. },
  9. // update (dt) {},
  10. showWait(callBack=null){
  11. this.node.active = true;
  12. this.callBack = callBack;
  13. this.timeOut = setTimeout(()=>{
  14. this.hideWait();
  15. }, 8000);
  16. },
  17. hideWait(){
  18. if(this.timeOut)
  19. clearTimeout(this.timeOut);
  20. if(this.callBack)
  21. this.callBack();
  22. this.node.active = false;
  23. }
  24. });