game_run.ts 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import { _decorator, Component, Node, Tween } from 'cc';
  2. import { gameManager } from './gameManager';
  3. import { scene_item_data, task_data, widget_item_data } from '../../data/data';
  4. import { scene_layer } from './scene_layer';
  5. import { ui_layer } from './ui_layer';
  6. import { top_layer } from './top_layer';
  7. import { config } from '../config';
  8. import { loading_view } from './loading_view/loading_view';
  9. import { login_view } from './login_view/login_view';
  10. import { game_list } from './game_list_view/game_list';
  11. import { check_open } from './check_open';
  12. import { unLock_view } from './unLock_view/unLock_view';
  13. import { SdkUtil } from '../sdkUtil';
  14. import { game_health_view } from './game_health_view/game_health_view';
  15. const { ccclass, property } = _decorator;
  16. @ccclass('game_run')
  17. export class game_run extends Component {
  18. @property(Node) scene_layer:Node = null;
  19. @property(Node) ui_layer:Node = null;
  20. @property(Node) top_layer:Node = null;
  21. @property(Node) btn_close:Node = null;
  22. @property(Node) launch:Node = null;
  23. @property(Node) game_list:Node = null;
  24. @property(Node) login_view:Node = null;
  25. @property(Node) loading_view:Node = null;
  26. @property(Node) game_health_view:Node = null;
  27. @property(Node) loading_level:Node = null;
  28. @property(Node) check_open:Node = null;
  29. @property(Node) unLock_view:Node = null;
  30. @property(gameManager) mGameManger:gameManager = null;
  31. protected start(): void {
  32. SdkUtil.ttRegisterSidebar()
  33. this.btn_close.on(Node.EventType.TOUCH_END,()=>{
  34. this.close()
  35. })
  36. }
  37. public unInit(){
  38. Tween.stopAll()
  39. this.ui_layer.getComponent(ui_layer).unInit()
  40. this.top_layer.getComponent(top_layer).unInit()
  41. this.scene_layer.getComponent(scene_layer).unInit()
  42. }
  43. public close(){
  44. this.node.removeFromParent()
  45. }
  46. public run(){
  47. }
  48. public showUnLockView(lock_one_call,lock_all_one_day){
  49. this.unLock_view.getComponent(unLock_view).show(lock_one_call,lock_all_one_day)
  50. }
  51. public runAll(){
  52. this.game_health_view.active = true;
  53. this.loading_view.active = false;
  54. this.login_view.active = false;
  55. this.game_list.active = false;
  56. this.mGameManger.initGR(this)
  57. this.game_health_view.getComponent(game_health_view).startShow(()=> {
  58. this.game_health_view.active = false;
  59. this.showLoading()
  60. })
  61. }
  62. public showLoading() {
  63. this.loading_view.active = true;
  64. this.loading_view.getComponent(loading_view).startLoading(()=>{
  65. this.loading_view.active = false;
  66. this.showLogin()
  67. this.login_view.getComponent(login_view).checkSidebar()
  68. })
  69. }
  70. public showLogin(){
  71. this.login_view.active = true;
  72. this.login_view.getComponent(login_view).initView(()=>{
  73. this.showGameList(()=>{ //加载完成关闭登录界面
  74. this.login_view.active = false;
  75. })
  76. })
  77. }
  78. public showGameList(call){
  79. this.game_list.active = true;
  80. this.game_list.getComponent(game_list).initView(call,()=>{
  81. this.game_list.active = false;
  82. this.showLogin()
  83. })
  84. }
  85. public loadSceneLayer(pages:scene_item_data[],type:number){
  86. this.scene_layer.getComponent(scene_layer).initScene(pages,type)
  87. }
  88. public loadUILayer(ui_widge_list:widget_item_data[]){
  89. this.ui_layer.getComponent(ui_layer).initUi(ui_widge_list)
  90. this.initTop()
  91. }
  92. public initTop(){
  93. this.top_layer.getComponent(top_layer).initTop()
  94. }
  95. public loadTextSound(ui_widge_list:widget_item_data[]){
  96. this.top_layer.getComponent(top_layer).initTextSoundLlist(ui_widge_list)
  97. }
  98. public initQuestionList(ui_widge_list:widget_item_data[]){
  99. this.top_layer.getComponent(top_layer).initQuestionList(ui_widge_list)
  100. }
  101. public initCountDownList(count_down_list:widget_item_data[]){
  102. this.ui_layer.getComponent(ui_layer).initCountDownList(count_down_list)
  103. }
  104. public initTaskUi(data:task_data){
  105. this.ui_layer.getComponent(ui_layer).initTaskUi(data)
  106. // if(data.type===config.task_type.guo_ju_qing){
  107. // }
  108. this.top_layer.getComponent(top_layer).initRuleAndTips()
  109. }
  110. public showFindRuleTips(){
  111. this.top_layer.getComponent(top_layer).showFindRuleTips()
  112. }
  113. public showTips(){
  114. this.top_layer.getComponent(top_layer).showTips()
  115. }
  116. public showRule(){
  117. this.top_layer.getComponent(top_layer).showRule()
  118. }
  119. public showCheck(call){
  120. this.check_open.getComponent(check_open).show(call)
  121. }
  122. public backGameList(){
  123. this.unInit()
  124. this.onlaunch(()=>{
  125. this.showGameList(()=>{
  126. })
  127. })
  128. }
  129. public showLoadingLevel(){
  130. this.loading_level.active = true;
  131. }
  132. public hideLoadingLevel(){
  133. this.loading_level.active = false;
  134. }
  135. public loadTopLayer(){
  136. }
  137. public onlaunch(call){
  138. this.launch.active = true;
  139. call()
  140. this.scheduleOnce(()=>{
  141. this.launch.active = false;
  142. },0.7)
  143. }
  144. public isCurScenePageCheckWidgetFinish(widget_id:number):boolean{
  145. return this.scene_layer.getComponent(scene_layer).isCurScenePageCheckWidgetFinish(widget_id)
  146. }
  147. public isCurScenePageCheckWidgetShow(widget_id:number):boolean{
  148. return this.scene_layer.getComponent(scene_layer).isCurScenePageCheckWidgetShow(widget_id)
  149. }
  150. }