game_run.ts 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import { _decorator, Component, Node, sys, 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 { game_health_view } from './game_health_view/game_health_view';
  14. import { zb_login_view } from './zb_login_view/zb_login_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(Node) zb_login_view:Node = null;
  31. @property(Node) top_floor_layer:Node = null;
  32. @property(gameManager) mGameManger:gameManager = null;
  33. protected start(): void {
  34. this.btn_close.on(Node.EventType.TOUCH_END,()=>{
  35. this.close()
  36. })
  37. }
  38. public unInit(){
  39. Tween.stopAll()
  40. this.ui_layer.getComponent(ui_layer).unInit()
  41. this.top_layer.getComponent(top_layer).unInit()
  42. this.scene_layer.getComponent(scene_layer).unInit()
  43. }
  44. public close(){
  45. this.node.removeFromParent()
  46. }
  47. public run(){
  48. }
  49. public showUnLockView(lock_one_call,lock_all_one_day){
  50. this.unLock_view.getComponent(unLock_view).show(lock_one_call,lock_all_one_day)
  51. }
  52. public runAll(){
  53. this.zb_login_view.active = false;
  54. this.game_health_view.active = false;
  55. this.loading_view.active = false;
  56. this.login_view.active = false;
  57. this.game_list.active = false;
  58. this.mGameManger.initGR(this)
  59. if(config.is_zb) {
  60. this.showZbLoginView()
  61. } else {
  62. if(sys.platform==sys.Platform.MOBILE_BROWSER) {
  63. this.showLoading()
  64. } else {
  65. this.showHealthView()
  66. }
  67. }
  68. }
  69. public showZbLoginView() {
  70. this.zb_login_view.active = true;
  71. this.zb_login_view.getComponent(zb_login_view).initView(()=> {
  72. this.showHealthView()
  73. })
  74. }
  75. public showHealthView() {
  76. this.game_health_view.active = true;
  77. this.game_health_view.getComponent(game_health_view).startShow(()=> {
  78. this.game_health_view.active = false;
  79. this.showLoading()
  80. })
  81. }
  82. public showLoading() {
  83. this.loading_view.active = true;
  84. this.loading_view.getComponent(loading_view).startLoading(()=>{
  85. this.loading_view.active = false;
  86. this.showLogin()
  87. this.login_view.getComponent(login_view).checkSidebar()
  88. })
  89. }
  90. public showLogin(){
  91. this.login_view.active = true;
  92. this.login_view.getComponent(login_view).initView(()=>{
  93. this.showGameList(()=>{ //加载完成关闭登录界面
  94. this.login_view.active = false;
  95. })
  96. })
  97. }
  98. public showGameList(call){
  99. this.game_list.active = true;
  100. this.game_list.getComponent(game_list).initView(call,()=>{
  101. this.game_list.active = false;
  102. this.showLogin()
  103. })
  104. }
  105. public loadSceneTask(data:task_data) {
  106. this.scene_layer.getComponent(scene_layer).initSceneTask(data)
  107. }
  108. public loadSceneLayer(pages:scene_item_data[],type:number){
  109. this.scene_layer.getComponent(scene_layer).initScene(pages,type)
  110. }
  111. public loadUILayer(ui_widge_list:widget_item_data[]){
  112. this.ui_layer.getComponent(ui_layer).initUi(ui_widge_list)
  113. this.initTop()
  114. }
  115. public initTop(){
  116. this.top_layer.getComponent(top_layer).initTop()
  117. }
  118. public loadTextSound(ui_widge_list:widget_item_data[]){
  119. this.top_layer.getComponent(top_layer).initTextSoundLlist(ui_widge_list)
  120. }
  121. public initQuestionList(ui_widge_list:widget_item_data[]){
  122. this.top_layer.getComponent(top_layer).initQuestionList(ui_widge_list)
  123. }
  124. public initCountDownList(count_down_list:widget_item_data[]){
  125. this.ui_layer.getComponent(ui_layer).initCountDownList(count_down_list)
  126. }
  127. public initTaskUi(data:task_data){
  128. this.ui_layer.getComponent(ui_layer).initTaskUi(data)
  129. // if(data.type===config.task_type.guo_ju_qing){
  130. // }
  131. this.top_layer.getComponent(top_layer).initRuleAndTips()
  132. }
  133. public showFindRuleTips(){
  134. this.top_layer.getComponent(top_layer).showFindRuleTips()
  135. }
  136. public showTips(){
  137. this.top_layer.getComponent(top_layer).showTips()
  138. }
  139. public showRule(){
  140. this.top_layer.getComponent(top_layer).showRule()
  141. }
  142. public showCheck(call){
  143. this.check_open.getComponent(check_open).show(call)
  144. }
  145. public backGameList(){
  146. this.unInit()
  147. this.onlaunch(()=>{
  148. this.showGameList(()=>{
  149. })
  150. })
  151. }
  152. public showLoadingLevel(){
  153. this.loading_level.active = true;
  154. }
  155. public hideLoadingLevel(){
  156. this.loading_level.active = false;
  157. }
  158. public loadTopLayer(){
  159. }
  160. public onlaunch(call,delay:number=0.7){
  161. this.launch.active = true;
  162. call()
  163. this.scheduleOnce(()=>{
  164. this.launch.active = false;
  165. },delay)
  166. }
  167. public isCurScenePageCheckWidgetFinish(widget_id:number):boolean{
  168. return this.scene_layer.getComponent(scene_layer).isCurScenePageCheckWidgetFinish(widget_id)
  169. }
  170. public isCurScenePageCheckWidgetShow(widget_id:number):boolean{
  171. return this.scene_layer.getComponent(scene_layer).isCurScenePageCheckWidgetShow(widget_id)
  172. }
  173. }