Beispiel #1
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;
        }
        public void Start()
        {
            siblingIndex = transform.GetSiblingIndex();
            parent       = transform.parent;
            canvas       = gameObject.GetComponentInParent <CanvasGroup>();
            Normal.SetActive(false);
            allowGaze = false;

            if (ContainerAPI.IsMedalUnlocked(Type))
            {
                if (Type == MedalType.Combat && ContainerAPI.IsMedalUnlocked(MedalType.AdvancedCombat))
                {
                    gameObject.SetActive(false);
                }

                if (Missing != null)
                {
                    Missing.SetActive(false);
                }

                if (Normal != null)
                {
                    Normal.SetActive(true);
                }
                animator = Normal.GetComponent <Animator>();
            }
        }
        public void Start()
        {
            Master.SetActive(false);
            Knight.SetActive(false);
            Padawan.SetActive(false);
            Initiate.SetActive(false);

            switch (ContainerAPI.GetJediRank())
            {
            case JediRank.Master:
                Master.SetActive(true);
                break;

            case JediRank.Knight:
                Knight.SetActive(true);
                break;

            case JediRank.Padawan:
                Padawan.SetActive(true);
                break;

            default:
                Initiate.SetActive(true);
                break;
            }
        }
Beispiel #4
0
        public void LaunchGame(AssaultAPI assault)
        {
            leaving = true;

            CameraFader.Fade(Constants.SceneFadeOutTime, () =>
            {
                switch (MenuController.ConfigToLoad.Game)
                {
                case Game.Assault:
                    if (MenuController.ConfigToLoad.IsBonusPlanet)
                    {
                        assault.StartAssaultMode(MenuController.ConfigToLoad.BonusPlanet,
                                                 MenuController.ConfigToLoad.PillarNumber,
                                                 (int)MenuController.DifficultyToLoad);
                    }
                    else
                    {
                        assault.StartAssaultMode(MenuController.ConfigToLoad.Planet,
                                                 MenuController.ConfigToLoad.PillarNumber,
                                                 (int)MenuController.DifficultyToLoad);
                    }
                    break;

                case Game.Duel:
                    ContainerAPI.GetDuelApi().Launch(MenuController.ConfigToLoad.Duelist, (int)MenuController.DifficultyToLoad);
                    break;
                }
            });
        }
 public void ToggleGoProMode(Toggle toggle)
 {
                 #if IS_DEMO_BUILD
     Log.Debug("ToggleGoProMode " + toggle.isOn);
     Disney.Vision.Internal.XimmerseTracker.UseGoProCameras = toggle.isOn;
     ContainerAPI.SaveGoProMode(toggle.isOn);
                 #endif
 }
Beispiel #6
0
        protected void Awake()
        {
            // setting agent references
            SetAgents();

            // creating container
            container = new ContainerAPI(Game.ForceVision);
        }
 public void ToggleUnlockAllProgression(Toggle toggle)
 {
                 #if IS_DEMO_BUILD
     Log.Debug("ToggleUnlockAllProgression " + toggle.isOn);
     ContainerAPI.AllProgressionUnlocked = toggle.isOn;
     ContainerAPI.SaveAllProgressionUnlocked(toggle.isOn);
                 #endif
 }
        private void Start()
        {
            duelApi           = ContainerAPI.GetDuelApi();
            assaultApi        = new AssaultAPI();
            allPassiveItems   = duelApi.Inventory.PassiveAbilities.GetAllItems();
            ownedPassiveItems = duelApi.Inventory.PassiveAbilities.GetOwnedItems();
            allForceItems     = duelApi.Inventory.ForcePowers.GetAllItems();
            ownedForceItems   = duelApi.Inventory.ForcePowers.GetOwnedItems();

            if (PanelType == EquipItemType.ForcePower)
            {
                defaultLabel = Title.text;

                List <ForcePowerItem> equippedItems = duelApi.Inventory.ForcePowers.GetEquippedItems();

                foreach (ForcePowerItem item in equippedItems)
                {
                    OnItemSelected(item);
                    break;
                }
            }
            else if (PanelType == EquipItemType.PassivePower1 || PanelType == EquipItemType.PassivePower2)
            {
                defaultLabel = Title.text;

                List <PassiveAbilityItem> equippedItems = duelApi.Inventory.PassiveAbilities.GetEquippedItems();

                if (equippedItems.Count >= 1 && PanelType == EquipItemType.PassivePower1)
                {
                    if (MenuController.ConfigToLoad.Game == Game.Assault)
                    {
                        if (IsAbilityUsableInAssault(equippedItems[0]))
                        {
                            OnItemSelected(equippedItems[0]);
                        }
                    }
                    else
                    {
                        OnItemSelected(equippedItems[0]);
                    }
                }

                if (equippedItems.Count >= 2 && PanelType == EquipItemType.PassivePower2)
                {
                    if (MenuController.ConfigToLoad.Game == Game.Assault)
                    {
                        if (IsAbilityUsableInAssault(equippedItems[1]))
                        {
                            OnItemSelected(equippedItems[1]);
                        }
                    }
                    else
                    {
                        OnItemSelected(equippedItems[1]);
                    }
                }
            }
        }
        private void Awake()
        {
            Container = new ContainerAPI(Game.ForceVision);

            if (Container.PlayerPrefs.PrefKeyExists(Constants.PorgUnlocked) || ContainerAPI.AllProgressionUnlocked)
            {
                LockIcon.SetActive(false);
            }
        }
        public override void Init()
        {
            container    = new ContainerAPI(Game);
            Volume.value = container.NativeSettings.GetVolume();
            SaberColorSelected((int)container.GetSavedSaberColorID(), true);
            UpdateBatteryLevels();
            SpatializationElement.Enabled = container.UseSpatialization();

            base.Init();
        }
        private void PlayStartupAudio()
        {
            AudioEvent.Play(AudioEventName.Holocron.CornerSpinIdle, Holocron);

            // Play everytime after the first time load
            ContainerAPI container = new ContainerAPI(Game.ForceVision);

            firstTimeRun = false;
            container.PlayerPrefs.SetPrefInt(Constants.GalaxyLoadedPlayerPrefKey, 1);
        }
 protected void Awake()
 {
     if (IsBonusPlanet && BonusPlanet == BonusPlanetType.Crait)
     {
         Locked = ContainerAPI.IsPlanetLocked(PlanetType.Hoth);
     }
     else
     {
         Locked = ContainerAPI.IsPlanetLocked(Planet);
     }
 }
Beispiel #13
0
        private void OnDestroy()
        {
            // Remove Input Events
            Sdk.Input.OnButtonUp -= OnButtonUp;

            // Kill SDK
            Sdk = null;

            // Kill the Container
            container.NativeBridge.OnLowMemory -= OnLowMemory;
            container.Dispose();
            container = null;
        }
Beispiel #14
0
        private static bool SaveFtueData(FtueData ftueData)
        {
            // saving ftue data
            string       json      = JsonUtility.ToJson(ftueData);
            ContainerAPI container = new ContainerAPI(Game.ForceVision);
            bool         success   = container.PersistentData.SaveText(FtueDataController.FtueDataFile, json, false);

            if (success)
            {
                Log.Debug("FTUE data saved successfully.");
            }
            else
            {
                Log.Warning("FTUE data was not saved!");
            }
            return(success);
        }
Beispiel #15
0
        private void OnDestroy()
        {
            // Remove Input Events
            Sdk.Tracking.OnBeaconStateChange        -= OnBeaconStateChanged;
            Sdk.Connections.OnPeripheralStateChange -= OnPeripheralStateChange;
            Sdk.Input.OnButtonDown  -= OnButtonDown;
            Sdk.Input.OnButtonUp    -= OnButtonUp;
            Sdk.Input.OnButtonPress -= OnButtonPress;

            // Kill SDK
            Sdk = null;

            // Kill the Container
            container.NativeBridge.OnLowMemory -= OnLowMemory;
            container.Dispose();
            container = null;
        }
        private void OnDestroy()
        {
            // removing listeners for HmdWatcher
            if (Sdk != null)
            {
                Sdk.Connections.OnPeripheralStateChange -= OnPeripheralStateChange;
            }

            // removing events
            LanguageSelectionEvents.OnLanguageSelected        -= OnLanguageSelected;
            LanguageSelectionEvents.OnLanguageSelectionClosed -= OnLanguageSelectionClosed;
            TitleScreenEvents.OnMenuSelected -= OnMenuSelected;

            // Kill the Container
            Container.Dispose();
            container = null;
        }
Beispiel #17
0
        public static bool PlayOnceEver(string eventName, GameObject source)
        {
            if (container == null)
            {
                container = new ContainerAPI(Game.ForceVision);
            }

            string key = PlayOnceKey + eventName;

            if (container.PlayerPrefs.PrefKeyExists(key))
            {
                return(false);
            }

            container.PlayerPrefs.SetPrefInt(key, 1);

            return(Play(eventName, source));
        }
Beispiel #18
0
        private static FtueData GetFtueData()
        {
            // creating container
            ContainerAPI container = new ContainerAPI(Game.ForceVision);

            FtueData ftueData = null;

            if (container.PersistentData.FileExists(FtueDataFile))
            {
                string data = container.PersistentData.LoadText(FtueDataFile);
                ftueData = JsonUtility.FromJson <FtueData>(data);
            }

            // cleaning up container
            container.Dispose();

            return(ftueData);
        }
Beispiel #19
0
        private void Start()
        {
            // Our Container API
            container = new ContainerAPI(Game.ForceVision);
            container.NativeBridge.OnLowMemory += OnLowMemory;

            // Setup the SDK
            Sdk.SetLogger(new VisionSdkLoggerProxy());
            OnSDKReady();

            Sdk.StereoCamera.UseMagnetometerCorrection = false;

            if (Triggers.Count > 0)
            {
                PlayAnimation(Triggers[0]);
                Triggers.RemoveAt(0);
            }
        }
 void Start()
 {
                 #if UNITY_ANDROID && !UNITY_EDITOR
     time = 0;
     PromptUI.SetActive(true);
     if (CheckPermissions() == true)
     {
         StartObbCheck();
     }
     else
     {
         container = new ContainerAPI(Game.ForceVision);
         PromptPermissionsBtn.SetActive(true);
         GoToSettingsBtn.SetActive(false);
     }
                 #else
     SceneManager.LoadScene("PreLaunch");
                 #endif
 }
Beispiel #21
0
        public IEnumerator Start()
        {
            // Unity... Animator wants you to wait for some time.
            // 4 Seconds seems to be the sweet spot for long editor times,
            // and is quick enough for faster load times, as it doesn't need precision
            yield return(new WaitForSeconds(4f));

            /*
             *  - First: Starts on
             *  - Second: haven’t beat maul on med.
             *  - Third: planet garel on med
             *  - Four: planet Loth on med
             *  - Fifth: planet Hoth on med
             *  - Six: beat takadona on med
             */

            DuelAPI api = ContainerAPI.GetDuelApi();

            if (api.Progress.HasCompleted(DuelAPI.Duelist.KyloRen, 2))
            {
                CoreAnimator.SetTrigger("TriggerLevel6");
            }
            else if (api.Progress.HasCompleted(DuelAPI.Duelist.DarthVader, 2))
            {
                CoreAnimator.SetTrigger("TriggerLevel5");
            }
            else if (api.Progress.HasCompleted(DuelAPI.Duelist.GrandInquisitor, 2))
            {
                CoreAnimator.SetTrigger("TriggerLevel4");
            }
            else if (api.Progress.HasCompleted(DuelAPI.Duelist.SeventhSister, 2))
            {
                CoreAnimator.SetTrigger("TriggerLevel3");
            }
            else if (api.Progress.HasCompleted(DuelAPI.Duelist.DarthMaul, 2))
            {
                CoreAnimator.SetTrigger("TriggerLevel2");
            }
            else
            {
                CoreAnimator.SetTrigger("TriggerLevel1");
            }
        }
Beispiel #22
0
        private void OnDestroy()
        {
            // Remove Input Events
            Sdk.Input.OnButtonUp -= OnButtonUp;

            MainNav.OnMenuShown     -= OnMenuShown;
            MainNav.OnMenuHidden    -= OnMenuHidden;
            MainNav.OnQuitButton    -= OnMenuQuit;
            MainNav.OnRestartButton -= OnMenuRestart;

            // Kill SDK
            Sdk = null;

            // Kill the Container
            container.NativeBridge.OnLowMemory -= OnLowMemory;
            container.Dispose();
            container = null;

            GazeWatcher.RemoveListener(gazeListener);
        }
Beispiel #23
0
        private void Start()
        {
            // Our Container API
            container = new ContainerAPI(Game.ForceVision);
            container.NativeBridge.OnLowMemory += OnLowMemory;

            // Setup the SDK
            Sdk.SetLogger(new VisionSdkLoggerProxy());
            OnSDKReady();

            Sdk.StereoCamera.UseMagnetometerCorrection = false;

            UIHolder.parent = Sdk.StereoCamera.transform;
            UIHolder.SnapToZero();

            ControlsPrompt.SetActive(false);
            PreparePanel.SetActive(true);

            currentState = PrepareHeadsetState.TrayInHeadset;
        }
Beispiel #24
0
        public void Init()
        {
            if (Locked == null)
            {
                return;
            }

            switch ((ColorID)ColorId)
            {
            case ColorID.GREEN:
                Locked.SetActive(ContainerAPI.GetJediRank() < JediRank.Padawan);
                break;

            case ColorID.PURPLE:
                Locked.SetActive(!ContainerAPI.IsMedalUnlocked(MedalType.Mastery));
                break;

            case ColorID.BLUE:
                Locked.SetActive(false);
                break;
            }
        }
Beispiel #25
0
        private void Start()
        {
            // Our Container API
            container = new ContainerAPI(Game.ForceVision);
            container.NativeBridge.OnLowMemory += OnLowMemory;

            // Hook up the debug canvas
            Log.SetUILogTarget(LogField);

            // Setup the SDK
            Sdk.SetLogger(new VisionSdkLoggerProxy());
            OnSDKReady();

            Sdk.StereoCamera.UseMagnetometerCorrection = false;

            if (GalaxyRotation != null)
            {
                GalaxyRotation.CameraTransform = Sdk.StereoCamera.transform;
            }

            Analytics.LogAction(new ActionAnalytics("start.complete.app"));
        }
Beispiel #26
0
        private void Start()
        {
            // Our Container API
            container = new ContainerAPI(Game.ForceVision);
            container.NativeBridge.OnLowMemory += OnLowMemory;

            if (MenuController.ConfigToLoad != null)
            {
                DuelistTitle.text = Localizer.Get("PedestalView.Title.LevelName." + MenuController.ConfigToLoad.GetTokenString()).Replace(Environment.NewLine,
                                                                                                                                          " ");

                // Medium on Core is called Easy. Otherwise, assign difficulty like normal
                if (MenuController.ConfigToLoad.Planet == PlanetType.Core && MenuController.DifficultyToLoad == Difficulty.Medium)
                {
                    DifficultyText.text = Localizer.Get("General.Name." + PlanetType.Core.ToString()) + ", " + Localizer.Get("LightsaberDuel.Difficulty.Easy");
                }
                else if (MenuController.ConfigToLoad.IsBonusPlanet)
                {
                    DifficultyText.text = Localizer.Get("General.Name." + MenuController.ConfigToLoad.BonusPlanet.ToString()) + ", " + Localizer.Get("LightsaberDuel.Difficulty." + MenuController.DifficultyToLoad.ToString());
                }
                else
                {
                    DifficultyText.text = Localizer.Get("General.Name." + MenuController.ConfigToLoad.Planet.ToString()) + ", " + Localizer.Get("LightsaberDuel.Difficulty." + MenuController.DifficultyToLoad.ToString());
                }

                PromptText.text = MenuController.ConfigToLoad.Game == Game.Assault ? Localizer.Get("LightsaberDuel.Prompt.SelectForcePower") : Localizer.Get("LightsaberDuel.Prompt.SelectForcePowers");
            }

            // Setup the SDK
            Sdk.SetLogger(new VisionSdkLoggerProxy());
            OnSDKReady();

            Sdk.StereoCamera.UseMagnetometerCorrection = false;

            gazeListener = new GazeListener(new [] { typeof(BaseEquipItem) }, OnItemGazedAt, OnItemGazedOff);
            GazeWatcher.AddListener(gazeListener);
        }
        public void UpdateState()
        {
            if (Configs == null)
            {
                return;
            }

            bool locked   = true;
            int  complete = 0;
            int  total    = Configs.Length;

            for (int i = 0; i < total; i++)
            {
                if (i == 0)
                {
                    // Exception when playing on hard (Not Core)
                    if (Configs[i].Planet != PlanetType.Core && Difficulty == 3 && Configs[i].Game == Game.Assault && ContainerAPI.GetDuelApi().Progress.HasCompleted(DuelAPI.Duelist.Archivist, 2))
                    {
                        locked = false;
                    }
                    else
                    {
                        locked = ContainerAPI.IsLevelLocked(Configs[i], Difficulty) || ContainerAPI.IsPlanetLocked(Configs[i].Planet);
                    }
                }

                if (ContainerAPI.IsLevelComplete(Configs[i], Difficulty))
                {
                    complete++;
                }
            }

            NotStarted.SetActive(locked);
            InProgress.SetActive(!locked && complete < total);
            Complete.SetActive(total == complete);
        }
Beispiel #28
0
        private void PlayStartupAudio()
        {
            AudioEvent.Play(AudioEventName.Holocron.CornerSpinIdle, Holocron);

            // Play everytime after the first time load
            ContainerAPI container = new ContainerAPI(Game.ForceVision);

            if (firstTimeRun && container.PlayerPrefs.GetPrefInt(Constants.GalaxyLoadedPlayerPrefKey, 0) == 1)
            {
                switch (ContainerAPI.GetJediRank())
                {
                case JediRank.Initiate:
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.GalaxyLoadRankInitiate, gameObject);
                    break;

                case JediRank.Padawan:
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.GalaxyLoadRankPadawan, gameObject);
                    break;

                case JediRank.Knight:
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.GalaxyLoadRankJediKnight, gameObject);
                    break;

                case JediRank.Master:
                    AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.GalaxyLoadRankJediMaster, gameObject);
                    break;
                }
            }
            else if (container.PlayerPrefs.GetPrefInt(Constants.GalaxyLoadedPlayerPrefKey, 0) == 0)
            {
                AudioEvent.PlayOnceEver(AudioEventName.Holocron.FirstTimeAppears, Holocron);
            }

            firstTimeRun = false;
            container.PlayerPrefs.SetPrefInt(Constants.GalaxyLoadedPlayerPrefKey, 1);
        }
 public void ToggleProfileSelection(Toggle toggle)
 {
     SetPofilesSelectableInFTUEAndRTUE(toggle.isOn);
     ContainerAPI.SaveProfileSelectionEnabled(toggle.isOn);
 }
        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;
                }
            }
        }