protected void LoadContent()
        {
                        #if !SKU_CHINA
            DownloadControllerFactory.CancelAll();

            Log.Debug("LoadContent");
            DownloadPopout.StartWindow(DownloadController.InstanceIdCount + 1, false);
            DownloadControllerFactory factory            = new DownloadControllerFactory();
            DownloadController        downloadController = factory.CreateDownloadController(this, (success, id) =>
            {
                if (success == true)
                {
                    Localizer.Load(true);
                }
                if (DownloadPopout != null)
                {
                    DownloadPopout.DownloadComplete(success, id);
                }
            }, Localizer.Locale, (prog) =>
            {
                if (DownloadPopout != null)
                {
                    if (prog.CurrentSection == prog.Sections && prog.FileRemainingCount > 0 && prog.PercentOfCurrentLoadingFileDownloaded < 0.9f)
                    {
                        DownloadPopout.gameObject.SetActive(true);
                    }
                    DownloadPopout.UpdateProgress(prog);
                }
            });
            downloadController.Init();
                        #endif
        }
Example #2
0
        private void LoadContent()
        {
            DownloadControllerFactory.CancelAll();
            DownloadControllerFactory factory = new DownloadControllerFactory();

            downloadPopout = Instantiate(DownloadPopoutPrefab);
            downloadPopout.transform.SetParent(MainCanvas, false);
            DownloadController downloadController = factory.CreateDownloadController(this, (success, id) =>
            {
                if (success == true)
                {
                    Localizer.Load(true);
                }
                if (downloadPopout != null)
                {
                    Destroy(downloadPopout);
                }
                downloadPopout = null;
            }, Localizer.Locale, (prog) =>
            {
                if (downloadPopout != null)
                {
                    downloadPopout.GetComponent <Disney.ForceVision.Internal.DownloadPopoutPanel>().UpdateProgress(prog);
                }
            });

            downloadController.Init();
        }
        IEnumerator ChangeLanguage()
        {
            yield return(new WaitForEndOfFrame());

            if (locale != Localizer.Locale)
            {
                loadingWindow = Instantiate(LoadingWindowPrefab);
                loadingWindow.transform.SetParent(transform.parent.transform, false);
                DownloadControllerFactory.CancelAll();
                DownloadControllerFactory factory            = new DownloadControllerFactory();
                DownloadController        downloadController = factory.CreateDownloadController(this, (success, id) =>
                {
                    loadingWindow.GetComponent <DownloadPanel>().DownloadComplete(success, id);
                    if (success == true)
                    {
                        activeSelection = LanguageDropDownUI.value;
                        Localizer.Load(true);

                        //set player pref and locale
                        PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);
                        prefsStorage.SetPrefString(Localizer.LanguagePrefKey, locale);

                        //set locale in Localizer
                        Localizer.Locale = locale;

                        string[] bankNames = Localizer.GetSoundBankNames();
                        StartCoroutine(Localizer.ChangeWWiseLanguage(bankNames, bankNames));
                    }
                    else
                    {
                        LanguageDropDownUI.value = activeSelection;
                    }
                }, locale, (prog) =>
                {
                    if (loadingWindow != null)
                    {
                        loadingWindow.GetComponent <DownloadPanel>().UpdateProgress(prog);
                    }
                });
                yield return(new WaitForEndOfFrame());

                downloadController.Init();
            }
        }
Example #4
0
        IEnumerator ChangeLanguage(string locale)
        {
            yield return(new WaitForEndOfFrame());

            if (locale != Localizer.Locale)
            {
#if SKU_CHINA
                OnAssetsReadyUseLanguage(locale);
#else
                LoadingWindow.GetComponent <DownloadPanel>().StartWindow(DownloadController.InstanceIdCount + 1);
                DownloadControllerFactory.CancelAll();
                DownloadControllerFactory factory            = new DownloadControllerFactory();
                DownloadController        downloadController = factory.CreateDownloadController(this, (success, id) =>
                {
                    if (LoadingWindow != null && LoadingWindow.GetComponent <DownloadPanel>() != null)
                    {
                        LoadingWindow.GetComponent <DownloadPanel>().DownloadComplete(success, id);
                        if (success == true)
                        {
                            Localizer.Load(true);
                            OnAssetsReadyUseLanguage(locale);
                        }
                    }
                }, locale, (prog) =>
                {
                    if (LoadingWindow != null && LoadingWindow.GetComponent <DownloadPanel>() != null)
                    {
                        LoadingWindow.GetComponent <DownloadPanel>().UpdateProgress(prog);
                    }
                });
                yield return(new WaitForEndOfFrame());

                downloadController.Init();
#endif
            }
            else
            {
                LanguageSelectionComplete();

                //load prelaunch if first time selecting language
                PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);
                if (prefsStorage.PrefKeyExists(Localizer.LanguagePrefKey) == false)
                {
                    prefsStorage.SetPrefString(Localizer.LanguagePrefKey, locale);

                    //only reload prelaunch if first language selected isnt first language in list.
                    //First language means they selected the default language for the app so no reload is necessary.

                    if (locale.Equals(Localizer.Locales[0]))
                    {
                        OnCloseButtonSelected();
                        if (TitleScreen != null)
                        {
                            TitleScreen.SetActive(true);
                        }
                    }
                    else
                    {
                        UnityEngine.SceneManagement.SceneManager.LoadScene("PreLaunch");
                    }
                }
            }

            ForceVisionAnalytics.LogLanguageSelect(locale);
        }