NodeTouch.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. LeavingPrintLocatoinLine: {
  5. default: null,
  6. type: cc.Prefab
  7. },
  8. },
  9. onLoad: function () {
  10. this.spawnLine = this.node.getComponent('SpawnLine');
  11. this.touchClick();
  12. },
  13. touchClick: function () {
  14. var self = this;
  15. self.node.on(cc.Node.EventType.TOUCH_START, function (event) {
  16. this.TOUCH_START(true);
  17. }.bind(this), self.node);
  18. self.node.on(cc.Node.EventType.TOUCH_MOVE, function (event) {
  19. }.bind(this), self.node);
  20. self.node.on(cc.Node.EventType.TOUCH_END, function (event) {
  21. this.TOUCH_END(true);
  22. }.bind(this), self.node);
  23. },
  24. TOUCH_START: function () {
  25. if(!GlobalData.game.isCanTouch)return;
  26. GlobalData.game.isItAlwaysTouch = true;
  27. if (GlobalData.game.playerCurrentZone == 1) {
  28. GlobalData.gameMode.StartTouchLongAcceleration();
  29. } else {
  30. this.spawnLine.spawnBlackLine();
  31. }
  32. },
  33. TOUCH_END: function () {
  34. if(!GlobalData.game.isCanTouch)return;
  35. GlobalData.game.isItAlwaysTouch = false;
  36. if (GlobalData.game.playerCurrentZone == 1) {
  37. GlobalData.gameMode.StopTouchLongAcceleration();
  38. }
  39. },
  40. });