ZhaoCaiLayer.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import SoundMgr from "../base/SoundMgr";
  2. import Tool from "../base/Tool";
  3. var baseLayer = require('BaseLayer');
  4. cc.Class({
  5. extends: baseLayer,
  6. properties: {
  7. labCoin: cc.Label,
  8. labLv: cc.Label,
  9. labCool: cc.Label,
  10. buyNode: cc.Node,
  11. getNode: cc.Node,
  12. coolNode: cc.Node,
  13. },
  14. // LIFE-CYCLE CALLBACKS:
  15. // onLoad () {},
  16. start () {
  17. this.labCoin.string = 1211;
  18. this.labLv.string = `LV${2}`;
  19. this.buyNode.active = false;
  20. this.getNode.active = false;
  21. this.coolNode.active = true;
  22. this.lerpTime = 18;
  23. this.daoshiji();
  24. this.schedule(this.daoshiji, 1, cc.macro.REPEAT_FOREVER);
  25. },
  26. onClickBuy(){
  27. SoundMgr.playClick();
  28. },
  29. onClickGet(){
  30. SoundMgr.playClick();
  31. },
  32. daoshiji(){
  33. if(this.lerpTime <= 1){
  34. this.getNode.active = true;
  35. this.coolNode.active = false;
  36. this.unschedule(this.daoshiji);
  37. return;
  38. }
  39. this.lerpTime -= 1;
  40. this.labCool.string = Tool.timesBySec(this.lerpTime);
  41. }
  42. });