SwitchOn.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. GameMode: {
  5. default: null,
  6. type: cc.Node,
  7. serializable: true,
  8. },
  9. SwichOnVoice: {
  10. default: null,
  11. type: cc.AudioClip,
  12. serializable: true,
  13. },
  14. Girl: {
  15. default: null,
  16. type: cc.Node,
  17. serializable: true,
  18. },
  19. ChiVoice: {
  20. default: null,
  21. type: cc.AudioClip,
  22. serializable: true,
  23. },
  24. },
  25. start()
  26. {
  27. this.StoryController = this.GameMode.getComponent('StoryController');
  28. },
  29. startRobot(event,customData) {
  30. cc.audioEngine.playEffect(this.SwichOnVoice, false);
  31. this.StoryController.Conversation.active = false;
  32. this.SwitchFadeOutAnim();
  33. },
  34. SwitchFadeOutAnim()
  35. {
  36. let action = cc.fadeOut(2);
  37. let CallF = cc.callFunc(function(){
  38. // this.EnableTouch = true;
  39. // this.node.active=false;
  40. this.GirlFadeInAnim();
  41. }.bind(this));
  42. let FadeInAnim = cc.sequence(action,CallF);
  43. this.node.runAction(FadeInAnim);
  44. },
  45. GirlFadeInAnim()
  46. {
  47. let action = cc.fadeIn(1);
  48. let CallF = cc.callFunc(function(){
  49. this.StoryController.EnableTouch = true;
  50. this.StoryController.Conversation.active = true;
  51. this.StoryController.PlayConversation();
  52. cc.audioEngine.playEffect(this.ChiVoice, false);
  53. //close block touch node
  54. this.node.destroy();
  55. this.Girl.getChildByName('GameTouchHead').active = false;
  56. this.Girl.getChildByName('GameTouchChest').active = false;
  57. }.bind(this));
  58. let FadeInAnim = cc.sequence(action,CallF);
  59. this.Girl.active=true;
  60. this.Girl.opacity = 0;
  61. this.Girl.runAction(FadeInAnim);
  62. }
  63. });