123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- import { _decorator, Component, Node, sys, Tween, Animation } from 'cc';
- import { gameManager } from './gameManager';
- import { scene_item_data, task_data, widget_item_data } from '../../data/data';
- import { scene_layer } from './scene_layer';
- import { ui_layer } from './ui_layer';
- import { top_layer } from './top_layer';
- import { config } from '../config';
- import { loading_view } from './loading_view/loading_view';
- import { login_view } from './login_view/login_view';
- import { game_list } from './game_list_view/game_list';
- import { check_open } from './check_open';
- import { unLock_view } from './unLock_view/unLock_view';
- import { game_health_view } from './game_health_view/game_health_view';
- import { zb_login_view } from './zb_login_view/zb_login_view';
- import { scene_page } from './scene_page';
- const { ccclass, property } = _decorator;
- @ccclass('game_run')
- export class game_run extends Component {
- @property(Node) scene_layer:Node = null;
- @property(Node) ui_layer:Node = null;
- @property(Node) top_layer:Node = null;
- @property(Node) btn_close:Node = null;
- @property(Node) launch:Node = null;
- @property(Node) game_list:Node = null;
- @property(Node) login_view:Node = null;
- @property(Node) loading_view:Node = null;
- @property(Node) game_health_view:Node = null;
- @property(Node) loading_level:Node = null;
- @property(Node) check_open:Node = null;
- @property(Node) unLock_view:Node = null;
- @property(Node) zb_login_view:Node = null;
- @property(Node) top_floor_layer:Node = null;
- @property(gameManager) mGameManger:gameManager = null;
- protected start(): void {
- this.btn_close.on(Node.EventType.TOUCH_END,()=>{
- this.close()
- })
- }
- public unInit(){
- Tween.stopAll()
- this.ui_layer.getComponent(ui_layer).unInit()
- this.top_layer.getComponent(top_layer).unInit()
- this.scene_layer.getComponent(scene_layer).unInit()
- }
- public close(){
- this.node.removeFromParent()
- }
- public run(){
- }
- public showUnLockView(lock_one_call,lock_all_one_day){
- this.unLock_view.getComponent(unLock_view).show(lock_one_call,lock_all_one_day)
- }
- public runAll(){
- this.zb_login_view.active = false;
- this.game_health_view.active = false;
- this.loading_view.active = false;
- this.login_view.active = false;
- this.game_list.active = false;
- this.mGameManger.initGR(this)
- if(config.is_zb) {
- this.showZbLoginView()
- } else {
- if(sys.platform==sys.Platform.MOBILE_BROWSER) {
- this.showLoading()
- } else {
- this.showHealthView()
- }
- }
- }
- public showZbLoginView() {
- this.zb_login_view.active = true;
- this.zb_login_view.getComponent(zb_login_view).initView(()=> {
- this.showHealthView()
- })
- }
- public showHealthView() {
- this.game_health_view.active = true;
- this.game_health_view.getComponent(game_health_view).startShow(()=> {
- this.game_health_view.active = false;
- this.showLoading()
- })
- }
- public showLoading() {
- this.loading_view.active = true;
- this.loading_view.getComponent(loading_view).startLoading(()=>{
- this.loading_view.active = false;
- this.showLogin()
- this.login_view.getComponent(login_view).checkSidebar()
- })
- }
- public showLogin(){
- this.login_view.active = true;
- this.login_view.getComponent(login_view).show()
- this.login_view.getComponent(login_view).initView(()=>{
- this.showGameList(()=>{ //加载完成关闭登录界面
- this.login_view.active = false;
- this.login_view.getComponent(login_view).hide()
- })
- })
- }
- public showGameList(call){
- this.game_list.active = true;
- this.game_list.getComponent(game_list).initView(call,()=>{
- this.game_list.active = false;
- this.showLogin()
- })
- }
- public loadSceneTask(data:task_data) {
- this.scene_layer.getComponent(scene_layer).initSceneTask(data)
- }
- public loadSceneLayer(pages:scene_item_data[],type:number){
- this.scene_layer.getComponent(scene_layer).initScene(pages,type)
- }
- public getCurSceneLayerPage():scene_page{
- return this.scene_layer.getComponent(scene_layer).getCurScenePage()
- }
- public loadUILayer(ui_widge_list:widget_item_data[]){
- this.ui_layer.getComponent(ui_layer).initUi(ui_widge_list)
- this.initTop()
- }
- public initTop(){
- this.top_layer.getComponent(top_layer).initTop()
- }
- public loadTextSound(ui_widge_list:widget_item_data[]){
- this.top_layer.getComponent(top_layer).initTextSoundLlist(ui_widge_list)
- }
- public initQuestionList(ui_widge_list:widget_item_data[]){
- this.top_layer.getComponent(top_layer).initQuestionList(ui_widge_list)
- }
- public initCountDownList(count_down_list:widget_item_data[]){
- this.ui_layer.getComponent(ui_layer).initCountDownList(count_down_list)
- }
- public initTaskUi(data:task_data){
- this.ui_layer.getComponent(ui_layer).initTaskUi(data)
- // if(data.type===config.task_type.guo_ju_qing){
-
- // }
- this.top_layer.getComponent(top_layer).initRuleAndTips()
- }
- public showFindRuleTips(){
- this.top_layer.getComponent(top_layer).showFindRuleTips()
- }
- public showTips(){
- this.top_layer.getComponent(top_layer).showTips()
- }
- public showRule(){
- this.top_layer.getComponent(top_layer).showRule()
- }
- public showCheck(call){
- this.check_open.getComponent(check_open).show(call)
- }
- public backGameList(){
- this.unInit()
- this.onlaunch(()=>{
- this.showGameList(()=>{
- })
- })
- }
- public showLoadingLevel(){
- this.loading_level.active = true;
- this.loading_level.getComponent(Animation).play()
- }
- public hideLoadingLevel(){
- this.loading_level.active = false;
- this.loading_level.getComponent(Animation).stop()
- }
- public loadTopLayer(){
-
- }
- public onlaunch(call,delay:number=0.7){
- this.launch.active = true;
- call()
- this.scheduleOnce(()=>{
- this.launch.active = false;
- },delay)
- }
- public isCurScenePageCheckWidgetFinish(widget_id:number):boolean{
- return this.scene_layer.getComponent(scene_layer).isCurScenePageCheckWidgetFinish(widget_id)
- }
- public isCurScenePageCheckWidgetShow(widget_id:number):boolean{
- return this.scene_layer.getComponent(scene_layer).isCurScenePageCheckWidgetShow(widget_id)
- }
- }
|