Exemplo n.º 1
0
        public override IEnumerator Start()
        {
            GameStateDownload.LogWithTime("LTGameStateStart.START=====>");
            InitializeSparx(GameEngine.Instance.ApiServerAddress);
            InitializeFusion();
            InitializeReplication();
            yield return(new WaitUntil(() => CharacterCatalog.Instance.isModelsLoaded));//等CharacterModel相关资源加载完成

            InitializeOfflineData();
            while (EB.Assets.IsLoadingScene)
            {
                yield return(null);
            }

            Mgr.SetGameState <GameStateLogin>();
            GameStateDownload.LogWithTime("<=====LTGameStateStart.START");
        }
Exemplo n.º 2
0
        public override IEnumerator Start()
        {
            GameStateDownload.LogWithTime("LTGameStateLogin.Start=====>");
            if (ILRDefine.IS_FX)
            {
                if (!GameEngine.Instance.TextureDic.ContainsKey(GameEngine.Instance.LoginBGPath))
                {
                    yield return(GameEngine.Instance.SetStreamingAssetsBG(GameEngine.Instance.LoginBGPath));
                }
                if (!GameEngine.Instance.TextureDic.ContainsKey(GameEngine.Instance.BrandPath))
                {
                    yield return(GameEngine.Instance.SetStreamingAssetsBG(GameEngine.Instance.BrandPath));
                }
            }
            else if (Application.identifier.Equals("com.mkhx.xinkuai"))
            {
                if (!GameEngine.Instance.TextureDic.ContainsKey(GameEngine.Instance.BrandPath))
                {
                    yield return(GameEngine.Instance.SetStreamingAssetsBG(GameEngine.Instance.BrandPath));
                }
            }

            // wait network available
            #region wait network available
            while (Application.internetReachability == NetworkReachability.NotReachable)
            {
                yield return(GameEngine.Instance.StartCoroutine(ShowLoadingScreen()));

                yield return(GameEngine.Instance.StartCoroutine(ShowNetworkRetryDialog()));
            }
            #endregion

            // load LoginUI
            yield return(GameEngine.Instance.StartCoroutine(LoadLoginUI()));

            UIStack.Instance.ForceHideLoadingScreen();
            LoadingSpinner.Destroy();

            GameObject obj = GameObject.Find("DownloadHudUI");
            if (obj != null)
            {
                GameObject.Destroy(obj);
            }

            //清除表数据
            ClientDataUtil.OnResetTemplateManager();
            //清datalookup缓存
            DataLookupsCache.Instance.ClearCache();

            GameEngine.Instance.LoginListener.ResolveMHLoginEvent += OnResolveMHLoginEvent;
            GameEngine.Instance.LoginListener.LoginEvent          += OnLogin;
            GameEngine.Instance.LoginListener.LoginFailedEvent    += OnLoginFailed;
            GameEngine.Instance.LoginListener.UpdateEvent         += OnUpdateRequired;

            LoginManager.Instance.LoginExtraListener.ResolveAuthenticatorsEvent         += OnResolveAuthenticators;
            LoginManager.Instance.LoginExtraListener.ResolveMultipleAuthenticatorsEvent += OnResolveMultipleAuthenticators;
            LoginManager.Instance.LoginExtraListener.AuthorizedEvent += OnAuthorized;

            LoginManager.Instance.Api.ErrorHandler += OnApiError;

            //设置音效
            AudioManager.Initialize();
            //预加载主场景摄像机
            GlobalCameraData.LoadCameraData(GlobalCameraData.CAMPAIGN_VIEW_CAMERA);

            yield return(new WaitForSeconds(0.2f));//等待小段时间防止花屏

            Enumerate();

            GameStateDownload.LogWithTime("<=====LTGameStateLogin.Start");
        }