DzjjHallController.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. import FireEventObserver from '../framework/FireEventObserver';
  2. import PreloadManager from '../common/PreloadManager';
  3. import AudioControlManager from '../common/AudioControlManager';
  4. import Event from '../net/Event';
  5. import LogicUnitManager from '../framework/LogicUnitManager'
  6. import Common from '../common/Common';
  7. cc.Class({
  8. extends: FireEventObserver,
  9. properties: {
  10. // progressBar: cc.ProgressBar,
  11. // wxLogin:cc.Button,
  12. // ykLogin:cc.Button,
  13. // zhLogin:cc.Button,
  14. // ljLogin:cc.Button,
  15. // yk2Login:cc.Button,
  16. // loginBtnNode:cc.Node,
  17. // loadproNode:cc.Node,
  18. // loginBannerNode:cc.Node,
  19. // regAndreadNode:cc.Node,
  20. // regNode:cc.Node,
  21. // readNode:cc.Node,
  22. // gotoRegBtn:cc.Node,
  23. plane:cc.Node,
  24. gamsNode:cc.Node,
  25. },
  26. onLoad()
  27. {
  28. // window['onGameBoot']();
  29. // cc.macro.ENABLE_CULLING = false;
  30. // this.loginBtnNode.active = false
  31. // this.progressBarTarget = 0;
  32. // this.scale = 1;
  33. // this.initListener();
  34. // this.preloadCount = 0;
  35. // this.preloadTotal = 5;
  36. // this.lum = LogicUnitManager;
  37. // this.loginLogic = this.lum.getBehavior('LoginBehavior');
  38. // // this.loginLogic.CreateLoginStart();
  39. // this.bloaded = true
  40. // this.playShow()
  41. // this.show()
  42. },
  43. initListener()
  44. {
  45. // this.onBehaviorEvent('LoginBehavior',Event.COM_MSG.PRELOAD_DONE,this.onLoaded.bind(this));
  46. // this.onBehaviorEvent('LoginBehavior',Event.SOCKET_MSG.OPEN, this.onSocketOpen.bind(this));
  47. },
  48. onSocketOpen(sender,result)
  49. {
  50. this.bloaded = true
  51. },
  52. onLoaded(sender, result)
  53. {
  54. // this.preloadCount++;
  55. // this.progressBarTarget = this.preloadCount / this.preloadTotal;
  56. // console.log("this.preloadCount:"+this.preloadCount+"this.progressBarTarget:"+this.progressBarTarget+"")
  57. // if (this.progressBarTarget >= 1 && this.bloaded)
  58. // {
  59. // this.onResourcesLoaded();
  60. // }
  61. },
  62. start()
  63. {
  64. // this.preloadManager = new PreloadManager();
  65. // this.audioControlManager = new AudioControlManager();
  66. // //加载动画和预制体
  67. // this.preloadManager.run();
  68. // //加载音频
  69. // this.audioControlManager.run();
  70. // var self = this;
  71. // cc.director.preloadScene("hall", function(){
  72. // console.log("preload scene battle");
  73. // self.onLoaded();
  74. // })
  75. },
  76. onResourcesLoaded()
  77. {
  78. this.loginBtnNode.active = true
  79. this.loadproNode.active = false
  80. },
  81. update(dt)
  82. {
  83. // if (this.progressBar.progress < this.progressBarTarget)
  84. // {
  85. // this.progressBar.progress += dt*this.scale
  86. // }
  87. // if (this.progressBarTarget >= 1 && this.bloaded && this.loginLogic.needShowAuth == false) {
  88. // this.onResourcesLoaded();
  89. // } else if (this.progressBarTarget >= 5 / 6 && this.bloaded && this.loginLogic.needShowAuth == false) {
  90. // this.onResourcesLoaded();
  91. // }
  92. },
  93. clickWXLogin(sender)
  94. {
  95. //weixin login
  96. // this.loginLogic.login()
  97. },
  98. clickYKLogin(sender){
  99. //youke login
  100. cc.director.loadScene('hall');
  101. },
  102. clickZHLogin(sender){
  103. //zhang hao login
  104. sender.target.active = false
  105. this.ykLogin.node.active = false
  106. this.loginBannerNode.active = true
  107. this.ljLogin.node.active = true
  108. this.yk2Login.node.active = true
  109. },
  110. clickRegBtn(sender){
  111. this.regAndreadNode.active = true
  112. this.regNode.active = true
  113. },
  114. clickReadYsBtn(sender){
  115. this.regNode.active = false
  116. this.readNode.active = true
  117. },
  118. clickCloseReg(sender){
  119. if (this.regNode.active) {
  120. this.regAndreadNode.active = false
  121. }else{
  122. this.regNode.active = true
  123. this.readNode.active = false
  124. }
  125. },
  126. clickCarGameHall(sender){
  127. this.node.runAction(cc.sequence(cc.fadeOut(1.0),cc.callFunc(function(){
  128. cc.director.loadScene('cargamehall')
  129. })));
  130. },
  131. show()
  132. {
  133. var animationPlane = this.plane.getComponent(cc.Animation);
  134. var hallsGoFinished = function(){
  135. this.node.active = true
  136. };
  137. animationPlane.on('play', hallsGoFinished, this);
  138. this.node.active = true
  139. animationPlane.play('showplane');
  140. this.gamsNode.getComponent(cc.Animation).play('showDzjjgame')
  141. },
  142. showMy: function(){
  143. this.node.active = true
  144. }
  145. });