MenuGameMode.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. var aGameInstance = require('../GameInstance');
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. TalkingLabel: {
  6. default: null,
  7. type: cc.Label,
  8. serializable: true,
  9. },
  10. AudioControllerNode: {
  11. default: null,
  12. type: cc.Node,
  13. serializable: true,
  14. },
  15. },
  16. onLoad () {
  17. this.bRunScene = true;
  18. this.AudioControllerScp = this.AudioControllerNode.getComponent('AudioController');
  19. this.AudioControllerScp.playBGM('Game/Audios/BGM/Funny.wav',1,()=>{
  20. this.bRunScene = false;
  21. });
  22. },
  23. Menu(event, param) {
  24. if(this.bRunScene)
  25. {
  26. return;
  27. }
  28. this.bRunScene = true;
  29. this.AudioControllerScp.stopAll();
  30. //取消这个组件得所有计时器
  31. this.unscheduleAllCallbacks();
  32. aGameInstance.sceneIdx = parseInt(param);
  33. this.scheduleOnce(()=>{
  34. cc.director.loadScene("Game");
  35. },0.1);
  36. },
  37. Help(event, param)
  38. {
  39. switch (parseInt(param)) {
  40. case 0:
  41. this.TalkingLabel.string = '时间到三秒正好打中沙袋获胜';
  42. break;
  43. case 1:
  44. this.TalkingLabel.string = '时间流速加快正好打十秒获胜';
  45. break;
  46. case 2:
  47. this.TalkingLabel.string = '连续三次随机生成目标时间打中目标时间三次获胜';
  48. break;
  49. case 3:
  50. this.TalkingLabel.string = '连续三次随机生成目标时间打中三次获胜时间随正/逆流';
  51. break;
  52. default:
  53. break;
  54. }
  55. }
  56. });