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
        }
        /// <summary>
        /// Creates the download controller.
        /// </summary>
        /// <returns>The download controller.</returns>
        /// <param name="monobehaviour">Monobehaviour.</param>
        /// <param name="callback">Callback.</param>
        /// <param name="language">Language.</param>
        /// <param name="progressCallback">Progress callback.</param>
        /// <param name="overrideManifestVersion">Override manifest version.</param>
        public DownloadController CreateDownloadController(MonoBehaviour monobehaviour, Action <bool, int> callback = null, string language = "en_US", Action <Progress> progressCallback = null, string overrideManifestVersion = null)
        {
            DownloadController downloadController = new DownloadController(monobehaviour, callback, language, progressCallback, overrideManifestVersion);

            DownloadControllerFactory.downloadControllers.Add(downloadController);
            return(downloadController);
        }
Beispiel #3
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();
            }
        }
Beispiel #5
0
        private static void OnBeforeSceneLoadRuntimeMethod()
                #endif
        {
            if (isInitialized == false)
            {
#if !ENABLE_LOGS
                Debug.unityLogger.logEnabled = false;
                Ximmerse.InputSystem.XDevicePlugin.s_isLogEnabled = false;
#endif

                //init app config
                IApplicationConfig ApplicationConfig = new Config();

#if !UNITY_EDITOR_WIN
                //init analytics
                Analytics.Init(ApplicationConfig.GetPlatformConfig(ServiceType.Swrve));

                //init Crittercism
                Crittercism.Init(ApplicationConfig.GetPlatformConfig(ServiceType.Apteligent).Id);
                Crittercism.SetLogUnhandledExceptionAsCrash(false);
#endif

#if !UNITY_EDITOR
                //init KpiTracking
                KpiTracking.InitKpiTracking();
#endif

                //init remote logging
                                #if !RC_BUILD
                remoteLogger = new LogRemote(DefaultLogRemotePort);
                Log.Debug("remoteLogger = " + remoteLogger);

                SceneManager.sceneLoaded += OnSceneLoaded;
                                #endif

                                #if !SKU_CHINA
                DownloadController.PurgeCpipeCache();
                                #endif

                isInitialized = true;
            }
        }
Beispiel #6
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);
        }
        private void Setup()
        {
            DontDestroyOnLoad(InSceneContainerSounds);

            // adding listeners
            LanguageSelectionEvents.OnLanguageSelected        += OnLanguageSelected;
            LanguageSelectionEvents.OnLanguageSelectionClosed += OnLanguageSelectionClosed;

            // playing background music
            AudioEvent.Play(AudioEventName.Ftue.Stereo.BackgroundMusicStart, gameObject, 1.0f);

            //show language selection if not set already
            PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);

            if (prefsStorage.PrefKeyExists(Localizer.LanguagePrefKey) == true)
            {
                LanguageSelection.SetActive(false);
                TitleScreen.SetActive(true);
            }
            else
            {
                LanguageSelection.SetActive(true);
                TitleScreen.SetActive(false);
            }

            // getting bluetooth, listening for bluetooth state changes
            Container.NativeSettings.GetBluetoothState("StereoSetupCanvas");

            // getting brightness level, listening brightness level changes
            Container.NativeSettings.SetBrightness(MaxBrightness);

            Controller = new ControllerPeripheral(VisionSDK.ControllerName);
            Sdk.Connections.AddPeripheral(Controller);

            Sdk.Connections.OnPeripheralStateChange += OnPeripheralStateChange;

            resizeAlignFTUE.Sdk = Sdk;
            resizeAlignRTUE.Sdk = Sdk;

            StereoSetupFtueController    ftue = MainCanvas.GetComponentInChildren <StereoSetupFtueController>(true);
            StereoSetupNonFtueController rtue = MainCanvas.GetComponentInChildren <StereoSetupNonFtueController>(true);

            ftue.Sdk = Sdk;
            rtue.Sdk = Sdk;

            // starting device check timer
            deviceCheckTime = Time.time + deviceCheckInterval;

            // adding listeners for title screen related events
            TitleScreenEvents.OnMenuSelected += OnMenuSelected;

                        #if !RC_BUILD
            // adding listener for touch down time reached
            TouchDownTimer.OnTouchDownTimeReached += OnTouchDownTimeReached;
                        #endif

            QualityController qualityController = new QualityController(Sdk);
            qualityController.ApplyQuality();

                        #if UNITY_EDITOR
            currentVolume = Mathf.Floor(UnityEngine.Random.Range(0, 1f) * 10) / 10f;
                        #else
            Log.Debug("Call LoadContent from Start");
            LoadContent();
            currentVolume = container.NativeSettings.GetVolume();
                        #endif

            // 3D sound setting
            for (int i = 0; i < SpatializationToggles.Length; i++)
            {
                SpatializationToggles[i].isOn = container.UseSpatialization();
            }

            // If the phone is not supported, profile selection is always on
            if (!JCSettingsManager.HasDeviceProfile)
            {
                ProfileSelectionToggle.isOn         = true;
                ProfileSelectionToggle.interactable = false;
            }
            else
            {
                // profile selection override setting
                ProfileSelectionToggle.isOn = ContainerAPI.UseProfileSelection();
            }
            SetPofilesSelectableInFTUEAndRTUE(ProfileSelectionToggle.isOn);

                        #if IS_DEMO_BUILD
            ContainerAPI.LoadDemoOptions();

            // make demo options visible and set UI state
            DemoOptions.SetActive(true);
            OptionsSpacer.SetActive(false);
            AllProgressionUnlockedToggle.isOn = ContainerAPI.AllProgressionUnlocked;
            GoProModeToggle.isOn = Disney.Vision.Internal.XimmerseTracker.UseGoProCameras;
                        #endif

            // this controller is common to both ftue and rtue so lets log the OTA version here (new ota data should already be downloaded)
            string otaVersion = DownloadController.GetManifestVersion()[0];

            Analytics.LogAction(new ActionAnalytics(SystemInfo.deviceModel,
                                                    "StereoSetupStart.ota" + otaVersion + (JCSettingsManager.HasDeviceProfile ? ".supported_device" : ".unsupported_device"),
                                                    -1,
                                                    ContainerAPI.UseProfileSelection().ToString()
                                                    ));
            SetLanguage();

            if (CreditsEndMessage != null)
            {
                CreditsEndMessage.SetActive(ContainerAPI.IsMedalUnlocked(MedalType.Mastery));
            }

            // Check what device the app is running on and adjust the UI accordingly
            var device = Sdk.Settings.CurrentDevice;

            if (device != null)
            {
                switch (device.Name)
                {
                case "iPhone X":
                    Scaler.matchWidthOrHeight = 1f;
                    break;
                }
            }
        }