Exemplo n.º 1
0
        /// <summary>
        /// Sets that the call has been made.
        /// </summary>
        private static void SetCallMade()
        {
            PlayerPrefsStorage storage = new PlayerPrefsStorage(Game.ForceVision);

            storage.SetPrefInt(playerprefsKey, 1);
            callMadeCached = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes sliders and bluetooth interrogation.
        /// </summary>
        void Start()
        {
#if RC_BUILD
            if ((new NativeSettings()).IsDebuggerAttached())
            {
                Application.Quit();
            }
#endif

            SetLanguage();

            LoadContent();

#if UNITY_ANDROID
            bluetoothCheckTime = Time.time + bluetoothCheckInterval;
#endif

            container = new ContainerAPI(Game.ForceVision);
            container.NativeSettings.GetBluetoothState("PreLaunchViewController");

            float volumeLevel = container.NativeSettings.GetVolume();

            VolumeSlider.value = volumeLevel;

            container.NativeSettings.GetBrightness(OnBrightnessChanged);

            //check for and load hmd type player pref
            prefsStorage = new PlayerPrefsStorage(Game.ForceVision);

            isStarted = true;
        }
Exemplo n.º 3
0
        public string DeviceNameChosen()
        {
            PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);

            if (prefsStorage.PrefKeyExists(DeviceNameChosenPlayerPref))
            {
                return(prefsStorage.GetPrefString(DeviceNameChosenPlayerPref));
            }
            return(null);
        }
Exemplo n.º 4
0
        public static bool UseProfileSelection()
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            if (playerPrefs.PrefKeyExists(Constants.UseProfileSelection))
            {
                return(playerPrefs.GetPrefInt(Constants.UseProfileSelection) == 1);
            }

            return(false);
        }
Exemplo n.º 5
0
        public static void LoadDemoOptions()
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            if (playerPrefs.PrefKeyExists(Constants.AllProgressionUnlocked))
            {
                AllProgressionUnlocked = playerPrefs.GetPrefInt(Constants.AllProgressionUnlocked) == 1;
            }
            if (playerPrefs.PrefKeyExists(Constants.GoProMode))
            {
                Disney.Vision.Internal.XimmerseTracker.UseGoProCameras = playerPrefs.GetPrefInt(Constants.GoProMode) == 1;
            }
        }
Exemplo n.º 6
0
        public ColorID GetSavedSaberColorID()
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            // Default if never set.
            ColorID color = ColorID.BLUE;

            if (playerPrefs.PrefKeyExists(Constants.SaberColorPlayerPrefKey))
            {
                color = (ColorID)playerPrefs.GetPrefInt(Constants.SaberColorPlayerPrefKey);
            }

            return(color);
        }
Exemplo n.º 7
0
        public void SaveDeviceNameChosen(string deviceNameChosen)
        {
            PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);

            if (!string.IsNullOrEmpty(deviceNameChosen))
            {
                Log.Debug("SaveDeviceNameChosen : " + deviceNameChosen);
                prefsStorage.SetPrefString(DeviceNameChosenPlayerPref, deviceNameChosen);
            }
            else
            {
                Log.Debug("SaveDeviceNameChosen, delete key : " + DeviceNameChosenPlayerPref);
                prefsStorage.DeletePref(DeviceNameChosenPlayerPref);
            }
        }
Exemplo n.º 8
0
        private void OnAssetsReadyUseLanguage(string locale)
        {
            //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));

            Localizer.Load(true);
            UnityEngine.SceneManagement.SceneManager.LoadScene("PreLaunch");
        }
Exemplo n.º 9
0
        /// <summary>
        /// Gets whether or not the call has already been made.
        /// </summary>
        /// <returns><c>true</c>, if the call has already been made, <c>false</c> otherwise.</returns>
        private static bool GetCallMade()
        {
            if (testCall)
            {
                return(false);
            }

            if (callMadeCached)
            {
                return(true);
            }

            PlayerPrefsStorage storage = new PlayerPrefsStorage(Game.ForceVision);

            callMadeCached = storage.GetPrefInt(playerprefsKey, 0) > 0;

            return(callMadeCached);
        }
        private void Start()
        {
            // adding listeners for setup events
            StereoSetupEvents.OnBluetoothStateUpdate   += OnBluetoothState;
            StereoSetupEvents.OnHmdConnected           += OnHmdConnected;
            StereoSetupEvents.OnPeripheralConnected    += OnPeripheralConnected;
            StereoSetupEvents.OnPeripheralDisconnected += OnPeripheralDisconnected;
            StereoSetupEvents.OnMutedStateUpdate       += OnMutedState;
            StereoSetupEvents.OnVolumeChanged          += OnVolumeChanged;
            StereoSetupEvents.OnLightSaberCalibration  += OnLightSaberCalibration;

            // adding listener for toggle change event (which happens when a toggle is selected)
            StereoToggleGroup.OnToggleChange += OnToggleChangeHandler;

            // adding listener for countdown event
            Countdown.OnCountdownEvent += OnCountdownEventHandler;

            // adding listener for animation events
            GetComponent <AnimationEvents>().OnAnimationComplete += OnAnimationCompleteHandler;

            // getting volume level
            VolumeBar.fillAmount = SetupController.Container.NativeSettings.GetVolume();

            // setting default light saber sync countdown text
            defaultLightSaberSyncText = Localizer.Get(LightSaberSyncCountdownText.gameObject.GetComponent <LocalizedText>().Token);

            // updating the initial state of setup screens
            UpdateScreen(StereoSetupStep.Welcome);

            if (!JCSettingsManager.HasDeviceProfile)
            {
                UnsupportedPhonePopup.SetActive(true);
                UnsupportedPhoneButton.SetActive(true);
            }

            PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);

            // show required hardware screen the first time the player sees the FTUE
            if (!prefsStorage.PrefKeyExists(RequiredHardwareShown))
            {
                prefsStorage.SetPrefInt(RequiredHardwareShown, 1);
                RequiredHardwareScreen.SetActive(true);
            }
        }
Exemplo n.º 11
0
        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();
            }
        }
Exemplo n.º 12
0
        protected void Start()
        {
            string             locale       = null;
            PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);

            if (prefsStorage.PrefKeyExists(Localizer.LanguagePrefKey) == true)
            {
                locale = prefsStorage.GetPrefString(Localizer.LanguagePrefKey);
            }

            toggles = new Toggle[Localizer.Locales.Count];
            //load language prefabs
            bool foundMatch = false;

            for (int i = 0; i < Localizer.Locales.Count; i++)
            {
                GameObject languageGameObject = GameObject.Instantiate(LanguagePrefab);
                toggles[i] = languageGameObject.GetComponent <Toggle>();

                if (languageGameObject != null)
                {
                    if (languageGameObject.GetComponent <LanguageDisplay>() != null)
                    {
                        languageGameObject.transform.SetParent(TargetContent.transform, false);

                        bool isOn = false;
                        if (Localizer.Locales[i].Equals(locale))
                        {
                            isOn       = true;
                            foundMatch = true;
                        }

                        languageGameObject.GetComponent <LanguageDisplay>().Init(i, isOn);
                    }
                }
            }

            LanguageDisplay.OnToggleClick += OnToggleClick;

            ConfirmButton.interactable = foundMatch;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Disney.ForceVision.ContainerAPI"/> class.
        /// </summary>
        /// <param name="game">Game.</param>
        public ContainerAPI(Game game)
        {
            // We need a MonoBehaviour for Native to call into as well for Streaming Asset loading.
            GameObject bridge = GameObject.Find("ForceVisionNativeBridge") ?? new GameObject("ForceVisionNativeBridge",
                                                                                             typeof(NativeBridge));

            NativeBridge = bridge.GetComponent <NativeBridge>();

            // Data Storage / Loading
            StreamingAssets   = new StreamingAssetsStorage(game, NativeBridge);
            PersistentData    = new PersistentDataStorage(game);
            PlayerPrefs       = new PlayerPrefsStorage(game);
            cdnAssetLoaderApi = new Disney.ForceVision.Internal.CdnAssetLoaderApi(NativeBridge);

            // Native Settings
            NativeSettings = new NativeSettings();

                        #if UNITY_ANDROID && !UNITY_EDITOR
            NativeBridge.StartLowMemoryPoll(NativeSettings);
                        #endif
        }
Exemplo n.º 14
0
        private void Start()
        {
            Localizer.LoadLanguageDefinitions();

            PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision);

            if (prefsStorage.PrefKeyExists(Localizer.LanguagePrefKey) == true)
            {
                locale = prefsStorage.GetPrefString(Localizer.LanguagePrefKey);
            }

            //verrify pref is valid
            if (Localizer.Locales.IndexOf(locale) < 0)
            {
                locale = Localizer.Locales[0];
            }

            Localizer.Locale = locale;

            int count = 0;
            List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();

            foreach (string languageName in Localizer.LanguageNames)
            {
                if (locale.Equals(Localizer.GetLocaleFromLanguage(languageName)))
                {
                    activeSelection = count;
                }
                count++;
                options.Add(new Dropdown.OptionData()
                {
                    text = languageName
                });
            }
            LanguageDropDownUI.options = options;
            LanguageDropDownUI.value   = activeSelection;
        }
Exemplo n.º 15
0
        public static void SaveProfileSelectionEnabled(bool enabled)
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            playerPrefs.SetPrefInt(Constants.UseProfileSelection, (enabled) ? 1 : 0);
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
        public void SetSavedSaberColorID(int colorID)
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            playerPrefs.SetPrefInt(Constants.SaberColorPlayerPrefKey, colorID);
        }
Exemplo n.º 18
0
        public static void SaveGoProMode(bool enabled)
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            playerPrefs.SetPrefInt(Constants.GoProMode, (enabled) ? 1 : 0);
        }
Exemplo n.º 19
0
        public static void SaveAllProgressionUnlocked(bool enabled)
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            playerPrefs.SetPrefInt(Constants.AllProgressionUnlocked, (enabled) ? 1 : 0);
        }
        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;
                }
            }
        }
Exemplo n.º 21
0
        public void SetSpatialization(bool enabled)
        {
            PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision);

            playerPrefs.SetPrefInt(Constants.UseSpatialization, (enabled) ? 1 : 0);
        }