SubHallManger.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import GamesHallController from "../view/GamesHallController"
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. },
  6. ctor: function () {
  7. },
  8. onLoad () {
  9. },
  10. start () {
  11. },
  12. onDestroy()
  13. {
  14. },
  15. playShow(parentHall)
  16. {
  17. if (parentHall) {
  18. this.parentHall = parentHall
  19. }
  20. this.node.active = true
  21. console.log("this.node.width is ====",this.node.width)
  22. console.log("this.MoveNum is ====",this.MoveNum)
  23. var actionTo = cc.moveBy(0.3, cc.v2(-this.node.parent.width, 0));
  24. var actionTo1 = cc.moveBy(0.3, cc.v2(100, 0));
  25. this.node.width = this.node.parent.width
  26. this.node.runAction(actionTo)
  27. // if (this.plane) {
  28. // this.plane.runAction(actionTo1)
  29. // }
  30. this.setShowingHall(this)
  31. },
  32. playEnd(direction,nextScense)
  33. {
  34. var finished = cc.callFunc(function() {
  35. this.node.active = false;
  36. if (this.parentHall && this.parentHall.playShow && direction == "up") {
  37. this.parentHall.playShow()
  38. if (this.parentHall.parentHall && this.parentHall.parentHall.setHalllistDisplay) {
  39. this.parentHall.parentHall.setHalllistDisplay(true)
  40. }
  41. this.showingHall = this.parentHall
  42. }else if (direction == "down")
  43. {
  44. if (this.parentHall && this.parentHall.setHalllistDisplay) {
  45. this.parentHall.setHalllistDisplay(false)
  46. }
  47. this.showingHall.playShow(this)
  48. }else if(this.parentHall && nextScense && direction == 'horizontal')
  49. {
  50. nextScense.playShow(this.parentHall)
  51. this.showingHall = nextScense
  52. }
  53. this.setShowingHall(this.showingHall)
  54. }, this, null);
  55. var actionTo = cc.sequence(cc.moveBy(0.3, cc.v2(this.node.parent.width, 0)),finished);
  56. var actionTo1 = cc.moveBy(0.3, cc.v2(-103, 0));
  57. this.node.runAction(actionTo)
  58. // if (this.plane) {
  59. // this.plane.runAction(actionTo1)
  60. // }
  61. },
  62. setShowingHall(Hall)
  63. {
  64. if (this.parentHall && this.parentHall.setShowingHall && this.parentHall != this) {
  65. this.showingHall = Hall
  66. this.parentHall.setShowingHall(this.showingHall)
  67. }
  68. }
  69. });