MenuGameMode.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. var aGameInstance = require('../GameInstance');
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. LoadingBG: {
  6. default: null,
  7. type: cc.Node,
  8. serializable: true,
  9. },
  10. TalkingLabel: {
  11. default: null,
  12. type: cc.Label,
  13. serializable: true,
  14. },
  15. TalkingSpNode: {
  16. default: null,
  17. type: cc.Node,
  18. serializable: true,
  19. },
  20. AudioControllerNode: {
  21. default: null,
  22. type: cc.Node,
  23. serializable: true,
  24. },
  25. },
  26. onLoad () {
  27. this.bRunScene = true;
  28. this.AudioControllerScp = this.AudioControllerNode.getComponent('AudioController');
  29. this.AudioControllerScp.playBGM('Game/Audios/BGM/Funny.wav',1,()=>{
  30. this.bRunScene = false;
  31. this.LoadingBG.active = false;
  32. });
  33. this.TalkingSpNodeScp = this.TalkingSpNode.getComponent('TalkingSp');
  34. },
  35. Menu(event, param) {
  36. if(this.bRunScene)
  37. {
  38. return;
  39. }
  40. this.bRunScene = true;
  41. this.AudioControllerScp.stopAll();
  42. //取消这个组件得所有计时器
  43. this.unscheduleAllCallbacks();
  44. aGameInstance.sceneIdx = parseInt(param);
  45. this.scheduleOnce(()=>{
  46. cc.director.loadScene("Game");
  47. },0.1);
  48. },
  49. Help(event, param)
  50. {
  51. this.TalkingSpNodeScp.PlayScaleAni();
  52. switch (parseInt(param)) {
  53. case 0:
  54. this.TalkingLabel.string = '三秒时正好打中沙袋获胜!';
  55. break;
  56. case 1:
  57. this.TalkingLabel.string = '十秒时正好打中沙袋获胜,小心时间流速变快了哦!';
  58. break;
  59. case 2:
  60. this.TalkingLabel.string = '连续“三次”随机生成目标时间,打中三次获胜!哈哈,难度越来越高了!';
  61. break;
  62. case 3:
  63. this.TalkingLabel.string = '连续“三次”随机生成目标时间,打中三次获胜。小心!这次时间可不一定正着流动哦!';
  64. break;
  65. default:
  66. break;
  67. }
  68. }
  69. });