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 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; } }
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; } } }
private void Start() { PillarConfig currentConfig = null; GuardianPinConfig.Clear(); // Guardian Track, this one is weird. // If the hard archivist is not beating but all hard duelist are, only pin the core (if TD / Chess are beat). if (!ContainerAPI.IsLevelComplete(GuardianFinalBattle, 3) && ContainerAPI.IsMedalUnlocked(MedalType.AdvancedCombat)) { if (ContainerAPI.IsMedalUnlocked(MedalType.Insight) && ContainerAPI.IsMedalUnlocked(MedalType.Leadership)) { // We need to know the given pillar too.. currentConfig = GuardianFinalBattle; // We only need to check the last 3 in this execption. for (int i = 0; i < 3; i++) { if (!ContainerAPI.IsLevelLocked(currentConfig, 3)) { GuardianPinConfig.Add(currentConfig); GuardianPinConfigDifficulty = 3; break; } currentConfig = currentConfig.PreviousConfig; } // Show the Planet Pin PinHolders[(int)PlanetType.Core].ShowPin(PinType.Guardian); } } // If you beat archivist on medium, we show pins for all planets that you haven't beat the duelist on else if (ContainerAPI.IsLevelComplete(GuardianFinalBattle, 2)) { currentConfig = GuardianFinalBattle; while (currentConfig != null) { // Only Duelist that are not on the core, another exception. if (currentConfig.Game == Game.Duel && !ContainerAPI.IsLevelComplete(currentConfig, 3) && currentConfig.Planet != PlanetType.Core) { // Save for later, More exceptions, need to check back 3 pillars here too.... PillarConfig second = currentConfig.PreviousConfig; PillarConfig first = (second != null) ? second.PreviousConfig : null; if (first != null && !ContainerAPI.IsLevelComplete(first, 3)) { GuardianPinConfig.Add(first); } else if (second != null && !ContainerAPI.IsLevelComplete(second, 3)) { GuardianPinConfig.Add(second); } else { GuardianPinConfig.Add(currentConfig); } GuardianPinConfigDifficulty = 3; // We show the pin? PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Guardian); } currentConfig = currentConfig.PreviousConfig; } } // If you havent... else { // Check medium progress then easy. for (int difficulty = 2; difficulty > 0; difficulty--) { currentConfig = GuardianFinalBattle; while (currentConfig != null) { if (!ContainerAPI.IsLevelLocked(currentConfig, difficulty)) { // Save for later GuardianPinConfig.Add(currentConfig); GuardianPinConfigDifficulty = difficulty; // We show the pin? PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Guardian); difficulty = 0; break; } currentConfig = currentConfig.PreviousConfig; } } } // Commander Track (Easy Only) currentConfig = CommanderFinalBattle; while (currentConfig != null) { // First one not locked. if (!ContainerAPI.IsLevelLocked(currentConfig, 1)) { // Last Level is unlocked but not beat if (currentConfig == CommanderFinalBattle) { if (!ContainerAPI.IsLevelComplete(currentConfig, 1)) { PinHolders[(int)PlanetType.Core].ShowPin(PinType.Commander); CommanderPinConfig = currentConfig; } break; } // Save for later CommanderPinConfig = currentConfig; // We show the pin? PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Commander); break; } currentConfig = currentConfig.PreviousConfig; } // Consular Track (Easy Only) currentConfig = ConsularFinalBattle; while (currentConfig != null) { // First one not locked. if (!ContainerAPI.IsLevelLocked(currentConfig, 1)) { // Last Level is unlocked if (currentConfig == ConsularFinalBattle) { // but not beat if (!ContainerAPI.IsLevelComplete(currentConfig, 1)) { PinHolders[(int)PlanetType.Core].ShowPin(PinType.Consular); ConsularPinConfig = currentConfig; } break; } // Save for later ConsularPinConfig = currentConfig; // We show the pin? PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Consular); break; } currentConfig = currentConfig.PreviousConfig; } }
private void SetupDifficulty(Game game) { // Need to find all the pillars and figure out the highest unlocked difficulty. CurrentDifficulty = Difficulty.Easy; EasyButton.Locked = false; DifficultyHolder.SetActive(game == Game.Assault || game == Game.Duel); // Not in a duel or assault if (!DifficultyHolder.activeSelf) { UpdatePillars(); return; } // Lock medium and hard until we know and deselect them all HardButton.Locked = MediumButton.Locked = true; HardButton.Selected = MediumButton.Selected = EasyButton.Selected = false; EasyButton.SetDefault(); MediumButton.SetDefault(); HardButton.SetDefault(); DuelAPI duelApi = ContainerAPI.GetDuelApi(); PlanetType planet = PlanetType.Naboo; // This will unlock Medium and Hard if possible for (int i = 0; i < pillars.Length; i++) { planet = pillars[i].Config.Planet; // Special exception for hard duelists if (pillars[i].Config.PillarNumber == 1 && duelApi.Progress.HasCompleted(DuelAPI.Duelist.Archivist, 2) && pillars[i].Config.Planet != PlanetType.Core) { MediumButton.Locked = false; HardButton.Locked = false; } // Normal Path else if (pillars[i].Config.PreviousConfig != null) { if (MediumButton.Locked) { MediumButton.Locked = !ContainerAPI.IsLevelComplete(pillars[i].Config.PreviousConfig, (int)Difficulty.Medium); } if (HardButton.Locked) { HardButton.Locked = !ContainerAPI.IsLevelComplete(pillars[i].Config.PreviousConfig, (int)Difficulty.Hard); } } // First Levels else { if (planet == PlanetType.DarkSide) { if (MediumButton.Locked) { MediumButton.Locked = (ContainerAPI.AllProgressionUnlocked) ? false : !duelApi.Progress.HasCompleted(DuelAPI.Duelist.Rey, 1); } if (HardButton.Locked) { HardButton.Locked = (ContainerAPI.AllProgressionUnlocked) ? false : !duelApi.Progress.HasCompleted(DuelAPI.Duelist.Rey, 2); } } else { if (MediumButton.Locked) { MediumButton.Locked = (ContainerAPI.AllProgressionUnlocked) ? false : !duelApi.Progress.HasCompleted(DuelAPI.Duelist.KyloRen, 1); } if (HardButton.Locked) { HardButton.Locked = (ContainerAPI.AllProgressionUnlocked) ? false : !duelApi.Progress.HasCompleted(DuelAPI.Duelist.Archivist, 2); } } } // Special exception for core duel track if (pillars[i].Config.Planet == PlanetType.Core && (pillars[i].Config.Game == Game.Duel || pillars[i].Config.Game == Game.Assault)) { if (!ContainerAPI.IsMedalUnlocked(MedalType.Insight) || !ContainerAPI.IsMedalUnlocked(MedalType.Leadership) || !ContainerAPI.IsMedalUnlocked(MedalType.AdvancedCombat)) { HardButton.Locked = true; } } } // If the planet is Core, there are only two difficulties, Medium and Hard. Medium is called Easy to the Player EasyButton.gameObject.SetActive(planet != PlanetType.Core); ButtonOrientation(planet != PlanetType.Core); MediumButtonText.text = Localizer.Get((planet != PlanetType.Core) ? "LightsaberDuel.Difficulty.Medium" : "LightsaberDuel.Difficulty.Easy"); // Hard or Medium unlocked? if (!HardButton.Locked) { CurrentDifficulty = Difficulty.Hard; HardButton.Selected = true; } else if (!MediumButton.Locked) { CurrentDifficulty = Difficulty.Medium; MediumButton.Selected = true; } else if (!EasyButton.Locked) { EasyButton.Selected = true; } // Update all 3 pillars based on new difficulty selection UpdatePillars(); }