/// <summary> /// Handler when the exit button is selected /// </summary> public void OnExitButtonSelected() { // playing sound AudioEvent.Play(AudioEventName.Ftue.Stereo.ExitButton, gameObject); // hide premission denied ui AndroidPermissionDenied.SetActive(false); // hiding the exit popup ExitPopup.SetActive(false); // going back to the title screen TitleController.gameObject.SetActive(true); // displaying welcome screen UpdateScreen(StereoSetupStep.Welcome, false); // resetting nav icons MenuToggleGroup.ResetToggles(); // exiting, so farthest step is back to none farthestStep = StereoSetupStep.None; // hiding the nav icons NavIcons.SetActive(false); // hiding saber not found ui SaberNotFound.SetActive(false); // allow popups to show up if the player starts up FTUE again shouldDisplayAndroidPopup = true; shouldDisplayLocServicesPopup = true; }
/// <summary> /// Shows or hides an element on the screen based on what step in the FTUE the player is on /// </summary> private void ShowAndHideScreenElement(GameObject element, string exitAnimation, StereoSetupStep step1, StereoSetupStep step2) { if (currentStep > step1 && currentStep < step2 && !element.activeSelf) { element.SetActive(true); } if ((currentStep == step1 || currentStep == step2) && element.activeSelf) { element.GetComponent <Animator>().Play(exitAnimation); } }
protected void OnToggleChangeHandler(object sender, ToggleEventArgs eventArgs) { StereoSetupStep step = (StereoSetupStep)eventArgs.SelectedToggle.transform.GetSiblingIndex(); UpdateScreen(step); }
private void UpdateScreen(StereoSetupStep step, bool shouldAnimate = true) { // validating that is not the current step number if (step == currentStep || step < StereoSetupStep.Welcome || step > StereoSetupStep.AlignPhone) { return; } // setting the current step of setup currentStep = step; if (currentStep == StereoSetupStep.PreparedToSync) { #if UNITY_ANDROID && !UNITY_EDITOR //check for permissons, pip screen if needed AndroidJavaClass permissions = new AndroidJavaClass("com.disney.forcevision.permissions.Permissions"); object[] args = new object[1]; args[0] = new string[] { "android.permission.ACCESS_COARSE_LOCATION" }; bool isPermitted = permissions.CallStatic <bool>("CheckPermission", args); if (isPermitted == false && shouldDisplayLocServicesPopup) { AndroidPermissionPrompt.SetActive(true); PrePromptAndroidPermission.SetActive(true); AndroidPermissionConfirmed.SetActive(false); shouldDisplayLocServicesPopup = false; } #endif } // updating the farthest step flag if (currentStep > farthestStep) { farthestStep = currentStep; // enabling interactable MenuToggleGroup.SetToggleInteractable((int)farthestStep, true); // if there's a step after the current step, make its toggle interactable if ((currentStep + 1) <= StereoSetupStep.AlignPhone) { MenuToggleGroup.SetToggleInteractable((int)(currentStep + 1), true); } } // Show and hide UI elements ShowAndHideScreenElement(NavIcons, "NavIconsExit", StereoSetupStep.Welcome, StereoSetupStep.AlignPhone); ShowAndHideScreenElement(LeftButtons, "CornerButtons_Outro", StereoSetupStep.None, StereoSetupStep.AlignPhone); ShowAndHideScreenElement(RightButtons, "CornerButtons_Outro", StereoSetupStep.None, StereoSetupStep.AlignPhone); if (currentStep == StereoSetupStep.CalibrateLightSaber && !SetupController.IsPeripheralCalibrated) { if (SetupController.IsControllerConnected) { isLightSaberCalibrationInProgress = true; SetupController.Controller.StartCalibration(SetupController.OnCalibrationStateChanged); } } else if (currentStep == StereoSetupStep.CalibrateLightSaber && SetupController.IsPeripheralCalibrated) { CalibrationBar.fillAmount = 1; CalibrationComplete.SetActive(true); } else if (currentStep != StereoSetupStep.CalibrateLightSaber && isLightSaberCalibrationInProgress) { isLightSaberCalibrationInProgress = false; if (SetupController.IsControllerConnected) { SetupController.Controller.StopCalibrating(); } } // setting stopper switch if (currentStep == StereoSetupStep.RemoveTray) { Device device = Sdk.Settings.CurrentDevice; if (device != null && device.StopperIn) { // updating prompt StopperPrompt.text = Localizer.Get(StereoSetupController.PositionTokenIn); // setting stopper switch to on StopperSwitch.SetState(SwitchState.On); } else { // updating prompt StopperPrompt.text = Localizer.Get(StereoSetupController.PositionTokenOut); // setting stopper switch to on StopperSwitch.SetState(SwitchState.Off); } } // displaying popup when placed in tray for Android if (Application.platform == RuntimePlatform.Android && currentStep == StereoSetupStep.PhoneInTray && shouldDisplayAndroidPopup) { AndroidPopup.SetActive(true); shouldDisplayAndroidPopup = false; } // setting toggle by passing the current step MenuToggleGroup.SetToggleByIndex((int)currentStep); // animating to the screen AnimateToScreen(shouldAnimate); }