SubHallManger.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. },
  5. ctor: function () {
  6. },
  7. onLoad () {
  8. },
  9. start () {
  10. },
  11. onDestroy()
  12. {
  13. },
  14. playShow(parentHall)
  15. {
  16. if (parentHall) {
  17. this.parentHall = parentHall
  18. }
  19. this.node.active = true
  20. var actionTo = cc.moveBy(0.3, cc.v2(-1226, 0));
  21. var actionTo1 = cc.moveBy(0.3, cc.v2(103, 0));
  22. this.gamesNode.runAction(actionTo)
  23. if (this.plane) {
  24. this.plane.runAction(actionTo1)
  25. }
  26. },
  27. playEnd(direction)
  28. {
  29. var finished = cc.callFunc(function() {
  30. this.node.active = false;
  31. if (this.parentHall && this.parentHall.playShow && direction) {
  32. this.parentHall.playShow()
  33. this.showingHall = this.parentHall
  34. }else if (this.parentHall && this.parentHall.playShow && !direction)
  35. {
  36. this.showingHall.playShow(this)
  37. }
  38. this.setShowingHall(this.showingHall)
  39. }, this, null);
  40. var actionTo = cc.sequence(cc.moveBy(0.3, cc.v2(1226, 0)),finished);
  41. var actionTo1 = cc.moveBy(0.3, cc.v2(-103, 0));
  42. this.gamesNode.runAction(actionTo)
  43. if (this.plane) {
  44. this.plane.runAction(actionTo1)
  45. }
  46. },
  47. setShowingHall(Hall)
  48. {
  49. if (this.parentHall && this.parentHall.setShowingHall) {
  50. this.showingHall = Hall
  51. this.parentHall.setShowingHall(this.showingHall)
  52. }
  53. }
  54. });