CarGameHallController.js 4.1 KB

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