SubHallManger.js 1.4 KB

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