SubHallManger.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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(100, 0));
  22. this.gamesNode.runAction(actionTo)
  23. if (this.plane) {
  24. this.plane.runAction(actionTo1)
  25. }
  26. this.setShowingHall(this)
  27. },
  28. playEnd(direction)
  29. {
  30. var finished = cc.callFunc(function() {
  31. this.node.active = false;
  32. if (this.parentHall && this.parentHall.playShow && direction) {
  33. this.parentHall.playShow()
  34. this.showingHall = this.parentHall
  35. }else if (this.parentHall && this.parentHall.playShow && !direction)
  36. {
  37. this.showingHall.playShow(this)
  38. }
  39. this.setShowingHall(this.showingHall)
  40. }, this, null);
  41. var actionTo = cc.sequence(cc.moveBy(0.3, cc.v2(1226, 0)),finished);
  42. var actionTo1 = cc.moveBy(0.3, cc.v2(-103, 0));
  43. this.gamesNode.runAction(actionTo)
  44. if (this.plane) {
  45. this.plane.runAction(actionTo1)
  46. }
  47. },
  48. setShowingHall(Hall)
  49. {
  50. if (this.parentHall && this.parentHall.setShowingHall) {
  51. this.showingHall = Hall
  52. this.parentHall.setShowingHall(this.showingHall)
  53. }
  54. }
  55. });