GamesHallController.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. nvren:cc.Node,
  24. hallsBtns:cc.Node,
  25. dzjjHall:cc.Node,
  26. },
  27. onLoad()
  28. {
  29. // window['onGameBoot']();
  30. // cc.macro.ENABLE_CULLING = false;
  31. // this.loginBtnNode.active = false
  32. // this.progressBarTarget = 0;
  33. // this.scale = 1;
  34. // this.initListener();
  35. // this.preloadCount = 0;
  36. // this.preloadTotal = 5;
  37. // this.lum = LogicUnitManager;
  38. // this.loginLogic = this.lum.getBehavior('LoginBehavior');
  39. // // this.loginLogic.CreateLoginStart();
  40. // this.bloaded = true
  41. // this.node.Opacity=0;
  42. // this.node.runAction(cc.fadeIn(1.0));
  43. this.dzjjHall.active = false
  44. this.animation = this.nvren.getComponent(cc.Animation);
  45. this.animation.on('finished', this.onGuideFinished, this);
  46. this.animation.play('nrcome1');
  47. },
  48. onGuideFinished(){
  49. console.log("onGuideFinished--------------------")
  50. this.animation.play('nrcome')
  51. },
  52. initListener()
  53. {
  54. // this.onBehaviorEvent('LoginBehavior',Event.COM_MSG.PRELOAD_DONE,this.onLoaded.bind(this));
  55. // this.onBehaviorEvent('LoginBehavior',Event.SOCKET_MSG.OPEN, this.onSocketOpen.bind(this));
  56. },
  57. onSocketOpen(sender,result)
  58. {
  59. this.bloaded = true
  60. },
  61. onLoaded(sender, result)
  62. {
  63. this.preloadCount++;
  64. this.progressBarTarget = this.preloadCount / this.preloadTotal;
  65. console.log("this.preloadCount:"+this.preloadCount+"this.progressBarTarget:"+this.progressBarTarget+"")
  66. if (this.progressBarTarget >= 1 && this.bloaded)
  67. {
  68. this.onResourcesLoaded();
  69. }
  70. },
  71. start()
  72. {
  73. // this.preloadManager = new PreloadManager();
  74. // this.audioControlManager = new AudioControlManager();
  75. // //加载动画和预制体
  76. // this.preloadManager.run();
  77. // //加载音频
  78. // this.audioControlManager.run();
  79. // var self = this;
  80. // cc.director.preloadScene("hall", function(){
  81. // console.log("preload scene battle");
  82. // self.onLoaded();
  83. // })
  84. },
  85. onResourcesLoaded()
  86. {
  87. this.loginBtnNode.active = true
  88. this.loadproNode.active = false
  89. },
  90. update(dt)
  91. {
  92. // if (this.progressBar.progress < this.progressBarTarget)
  93. // {
  94. // this.progressBar.progress += dt*this.scale
  95. // }
  96. // if (this.progressBarTarget >= 1 && this.bloaded && this.loginLogic.needShowAuth == false) {
  97. // this.onResourcesLoaded();
  98. // } else if (this.progressBarTarget >= 5 / 6 && this.bloaded && this.loginLogic.needShowAuth == false) {
  99. // this.onResourcesLoaded();
  100. // }
  101. },
  102. clickWXLogin(sender)
  103. {
  104. //weixin login
  105. // this.loginLogic.login()
  106. },
  107. clickYKLogin(sender){
  108. //youke login
  109. cc.director.loadScene('hall');
  110. },
  111. clickZHLogin(sender){
  112. //zhang hao login
  113. sender.target.active = false
  114. this.ykLogin.node.active = false
  115. this.loginBannerNode.active = true
  116. this.ljLogin.node.active = true
  117. this.yk2Login.node.active = true
  118. },
  119. clickRegBtn(sender){
  120. this.regAndreadNode.active = true
  121. this.regNode.active = true
  122. },
  123. clickReadYsBtn(sender){
  124. this.regNode.active = false
  125. this.readNode.active = true
  126. },
  127. clickCloseReg(sender){
  128. if (this.regNode.active) {
  129. this.regAndreadNode.active = false
  130. }else{
  131. this.regNode.active = true
  132. this.readNode.active = false
  133. }
  134. },
  135. clickCarGameHall(sender){
  136. this.playEnd('cargamehall')
  137. },
  138. clickDZJJHall(sender){
  139. var animation = this.hallsBtns.getComponent(cc.Animation);
  140. var hallsGoFinished = function(){
  141. // this.dzjjHall.active = true
  142. console.log(this.dzjjHall.getComponent('DzjjHallController'))
  143. this.dzjjHall.getComponent('DzjjHallController').show()
  144. };
  145. animation.on('finished', hallsGoFinished, this);
  146. animation.play('hallsgo');
  147. this.animation.play('nrgo')
  148. },
  149. clickReturnBtn(){
  150. },
  151. });