////////////////////////////////////////////////////////////////////////// public override string GetCurrentValueAsText() { if (IsChecked()) { if (m_UseCustomOnOff) { if (m_CustomHintsAreLocalizationKeys) { return(UAP_AccessibilityManager.Localize(m_CustomOn)); } return(m_CustomOn); } else { return(UAP_AccessibilityManager.Localize_Internal("Checkbox_Checked")); } } else { if (m_UseCustomOnOff) { if (m_CustomHintsAreLocalizationKeys) { return(UAP_AccessibilityManager.Localize(m_CustomOff)); } return(m_CustomOff); } else { return(UAP_AccessibilityManager.Localize_Internal("Checkbox_NotChecked")); } } }
////////////////////////////////////////////////////////////////////////// protected string CombinePrefix(string text) { string prefix = m_PrefixIsLocalizationKey ? UAP_AccessibilityManager.Localize(m_Prefix) : m_Prefix; if (prefix.Length == 0) { return(text); } if (prefix.IndexOf("{0}") != -1) { string resultText = prefix; resultText = resultText.Replace("{0}", text); if (m_AdditionalNameLabels != null && m_AdditionalNameLabels.Count > 0) { for (int i = 0; i < m_AdditionalNameLabels.Count; i++) { if (resultText.IndexOf("{" + (i + 1).ToString("0") + "}") != -1) { resultText = resultText.Replace("{" + (i + 1).ToString("0") + "}", GetLabelText(m_AdditionalNameLabels[i])); } } } return(resultText); } if (m_PrefixIsPostFix) { return(text + " " + prefix); } return(prefix + " " + text); }
////////////////////////////////////////////////////////////////////////// void TTS_Speak(string text, bool allowVoiceOver = true) { #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN if (UAP_AccessibilityManager.UseWindowsTTS()) { //Debug.Log("Speaking: " + text); WindowsTTS.Speak(text); } #elif (UNITY_STANDALONE_OSX || UNITY_EDITOR) && !UNITY_WEBPLAYER if (UAP_AccessibilityManager.UseMacOSTTS()) { //Debug.Log("Speaking: " + text); MacOSTTS.instance.Speak(text); } #elif UNITY_ANDROID if (UAP_AccessibilityManager.UseAndroidTTS()) { m_TTS_SpeakingTimer += (text.Length * 3.0f / 16.0f); AndroidTTS.SetSpeechRate(m_SpeechRate); AndroidTTS.Speak(text); } #elif UNITY_IOS if (UAP_AccessibilityManager.UseiOSTTS()) { m_TTS_SpeakingTimer += (text.Length * 3.0f / 16.0f); iOSTTS.StartSpeaking(text, allowVoiceOver && UAP_AccessibilityManager.IsVoiceOverAllowed(), m_SpeechRate); } #endif }
////////////////////////////////////////////////////////////////////////// private void OnInputFinished(string editedText, bool wasConfirmed) { // Set the text (if needed) if (wasConfirmed) { InputField inputField = GetInputField(); if (inputField != null) { inputField.text = editedText; // Call the appropriate OnEndEdit function of Unity UI (developer might have set up callbacks) inputField.onEndEdit.Invoke(editedText); } #if ACCESS_NGUI UIInput element = GetNGUIInputField(); if (element != null) { element.value = editedText; // Call the appropriate onSubmit function of NGUI UIInput (developer might have set up callbacks) element.Submit(); } #endif } // Conclude the interaction with the UAP Accessibility Manager UAP_AccessibilityManager.FinishCurrentInteraction(); }
// void Update() { // Get current element from Manager and check whether it is a child of this group GameObject go = UAP_AccessibilityManager.GetCurrentFocusObject(); // If the object didn't change, nothing needs to be done if (go == m_LastFocusObject) { return; } m_LastFocusObject = go; bool isSelected = false; if (UAP_AccessibilityManager.IsEnabled()) { if (go != null) { UAP_BaseElement element = go.GetComponent <UAP_BaseElement>(); if (m_AllElements.Contains(element)) { isSelected = true; } } } if (isSelected != m_Selected) { m_Selected = isSelected; gameObject.BroadcastMessage("Accessibility_Selected", isSelected, SendMessageOptions.DontRequireReceiver); } }
public void GetNextTextBlock() { if (!documentViewing) { return; } if (blocksIndex < blocksOfText.Count - 1) { blocksIndex++; } else { blocksIndex = 0; } try { text_result = blocksOfText[blocksIndex]; } catch (Exception e) { Debug.LogError("text block out of bounds"); } if (String.IsNullOrEmpty(text_result)) { text_result = "Δεν αναγνωρίστηκε, ξαναπροσπαθήστε."; } UAP_AccessibilityManager.Say(text_result); EventCamManager.onProcessEnded?.Invoke(); }
/// <summary> /// Clears the player's saved progress, and presents them with a notification telling them their progress has been cleared. /// </summary> public void ClearPlayerData() { PlayerPrefs.DeleteAll(); this.GetComponent <InkTextDisplay>().EraseUI(); //Tells InkTextDisplay.cs to clear all the onscreen text/buttons. this.GetComponent <InkTextDisplay>().startKnot = null; //Clears the "start knot" field, so that the game doesn't start anywhere that isn't the very beginning. //Creates text informing the player that their saved data has been erased. Text progressHasBeenClearedTextGameObject = Instantiate(textPrefab) as Text; progressHasBeenClearedTextGameObject.text = progressHasBeenClearedText; AccessibleLabel label = progressHasBeenClearedTextGameObject.gameObject.AddComponent(typeof(AccessibleLabel)) as AccessibleLabel; //Adds an accessible label to the text. progressHasBeenClearedTextGameObject.transform.SetParent(this.transform, false); UAP_AccessibilityManager.SelectElement(progressHasBeenClearedTextGameObject.gameObject); //Directs focus to the notification text, so that it starts being read automatically. //Creates a "return to menu" button. Text returnToMenuPressableGameObject = Instantiate(selectableTextPrefab) as Text; //Instantiates a "pressable text gameObject." (Our substitute for a button) returnToMenuPressableGameObject.gameObject.tag = "Return to menu button"; returnToMenuPressableGameObject.text = returnToMenuButtonText; returnToMenuPressableGameObject.transform.SetParent(this.transform, false); //Parents the pressable gameObject to the canvas (this gameObject).he canvas (this gameObject). setToPause = false; //Resets the game's pause status. this.GetComponent <PauseManager>().enabled = false; //Ensures the player can't pause/unpause before starting a new gameplay session. }
////////////////////////////////////////////////////////////////////////// public void ActivateTile(int index) { UAP_AccessibilityManager.Say("", false, false, UAP_AudioQueue.EInterrupt.All); Vector2 xyCoord = ConvertIndexToXYCoordinates(index); gridpanel tile = GetGridTile(index); // Check whether this tile is already selected if (tile == null || m_SelectedTile == tile) { AbortSelection(); return; } // Is this the first tile to be activated or the second? if (m_SelectedTile == null) { // Select, start sound m_SFXPlayer.clip = m_ActiveTile; m_SFXPlayer.loop = true; m_SFXPlayer.Play(); m_SelectedTile = tile; m_SelectionFrame.SetActive(true); m_SelectionFrame.transform.position = m_SelectedTile.transform.position; return; } // If second, check whether this tile is a neighbor to the first Vector2 selectedXY = ConvertIndexToXYCoordinates(m_SelectedTile.GetIndex()); Vector2 diff = selectedXY - xyCoord; // Is it too far away? if (Mathf.Abs(diff.x) + Mathf.Abs(diff.y) > 1.0f) { AbortSelection(); return; } // Temporarily block input in the AM UAP_AccessibilityManager.BlockInput(true); // Swap the tiles CancelPreview(true); int tileTypeSelected = m_SelectedTile.GetTileType(); m_SelectedTile.SetTileType(tile.GetTileType()); tile.SetTileType(tileTypeSelected); m_SelectedTile = null; m_SelectionFrame.SetActive(false); // Stop looping sound m_SFXPlayer.Stop(); m_MovesGained = 0; ++m_MoveCount; m_levelGoalUpdatedWithMove = false; EvaluateBoard(); }
/// <summary> /// Opens the first screen the player sees after they pause. /// </summary> public void OpenMainPauseScreen() { this.GetComponent <InkTextDisplay>().EraseUI(); //Tells InkTextDisplay.cs to clear all the onscreen text/buttons. //Creates text explaining that the game is paused. Text pauseScreenTextGameObject = Instantiate(textPrefab) as Text; pauseScreenTextGameObject.text = pauseScreenText; AccessibleLabel label = pauseScreenTextGameObject.gameObject.AddComponent(typeof(AccessibleLabel)) as AccessibleLabel; //Adds an accessible label to the text. pauseScreenTextGameObject.transform.SetParent(this.transform, false); UAP_AccessibilityManager.SelectElement(pauseScreenTextGameObject.gameObject); //Directs focus to the pause notification text, so that it starts being read automatically. //Creates an "unpause button," as an alternative to swiping up with three fingers again. (Both work for unpausing the game) Text resumePressableGameObject = Instantiate(selectableTextPrefab) as Text; //Instantiates a "pressable text gameObject." (Our substitute for a button) resumePressableGameObject.gameObject.tag = "Resume button"; resumePressableGameObject.text = resumeButtonText; resumePressableGameObject.transform.SetParent(this.transform, false); //Parents the pressable gameObject to the canvas (this gameObject). //Creates a "clear progress" button Text clearProgressPressableGameObject = Instantiate(selectableTextPrefab) as Text; //Instantiates a "pressable text gameObject." (Our substitute for a button) clearProgressPressableGameObject.gameObject.tag = "Are you sure you want to clear progress button"; clearProgressPressableGameObject.text = clearProgressButtonText; clearProgressPressableGameObject.transform.SetParent(this.transform, false); //Parents the pressable gameObject to the canvas (this gameObject). //Creates a "return to menu" button. Text returnToMenuPressableGameObject = Instantiate(selectableTextPrefab) as Text; //Instantiates a "pressable text gameObject." (Our substitute for a button) returnToMenuPressableGameObject.gameObject.tag = "Return to menu button"; returnToMenuPressableGameObject.text = returnToMenuButtonText; returnToMenuPressableGameObject.transform.SetParent(this.transform, false); //Parents the pressable gameObject to the canvas (this gameObject).he canvas (this gameObject). }
/// <summary> /// Asks the player if they're sure they'd like to clear their progress, and gives them the option of doing so. /// </summary> public void OpenAreYouSureScreen() { this.GetComponent <InkTextDisplay>().EraseUI(); //Tells InkTextDisplay.cs to clear all the onscreen text/buttons. //Creates text asking the player if they really want to clear their progress or not. Text areYouSureTextGameObject = Instantiate(textPrefab) as Text; areYouSureTextGameObject.text = areYouSureText; AccessibleLabel label = areYouSureTextGameObject.gameObject.AddComponent(typeof(AccessibleLabel)) as AccessibleLabel; //Adds an accessible label to the text. areYouSureTextGameObject.transform.SetParent(this.transform, false); UAP_AccessibilityManager.SelectElement(areYouSureTextGameObject.gameObject); //Directs focus to the notification text, so that it starts being read automatically. //Creates a "yes" button Text confirmClearDataPressableGameObject = Instantiate(selectableTextPrefab) as Text; //Instantiates a "pressable text gameObject." (Our substitute for a button) confirmClearDataPressableGameObject.gameObject.tag = "Confirm clear progress button"; confirmClearDataPressableGameObject.text = confirmClearDataButtonText; confirmClearDataPressableGameObject.transform.SetParent(this.transform, false); //Parents the pressable gameObject to the canvas (this gameObject). //Creates an "I change my mind" button. Text cancelClearDataPressableGameObject = Instantiate(selectableTextPrefab) as Text; //Instantiates a "pressable text gameObject." (Our substitute for a button) cancelClearDataPressableGameObject.gameObject.tag = "Cancel clear progress button"; cancelClearDataPressableGameObject.text = cancelClearDataButtonText; cancelClearDataPressableGameObject.transform.SetParent(this.transform, false); //Parents the pressable gameObject to the canvas (this gameObject). }
IEnumerator OnCorrectCode1() { if (UAP_AccessibilityManager.IsActive()) { UAP_AccessibilityManager.SelectElement(UAP_AccessibilityManager.GetCurrentFocusObject()); UAP_AccessibilityManager.StopSpeaking(); UAP_AccessibilityManager.Say("Correct Code: Welcome to the show.", false, true, UAP_AudioQueue.EInterrupt.All); } GetComponent <InputField>().enabled = false; if (UAP_AccessibilityManager.IsActive()) { yield return(new WaitForSeconds(1.0f)); } while (UAP_AccessibilityManager.IsSpeaking()) { yield return(new WaitForSeconds(0.25f)); } GetComponent <InputField>().enabled = true; //HACK: call coroutine twice for it to work?!? yield return(OnCorrectCode2()); yield return(OnCorrectCode2()); }
private void fieldDeSelected(string arg0) { UAP_AccessibilityManager.BlockInput(false); if (TouchScreenKeyboard.isSupported) { if (hasMoved && !TouchScreenKeyboard.visible) { //set back to initial position; frame.GetComponent <RectTransform>().localPosition = initPos; frame.GetComponent <RectTransform>().sizeDelta = new Vector2(initSize.x, initSize.y); hasMoved = false; } } else { //set back to initial position; frame.GetComponent <RectTransform>().localPosition = initPos; frame.GetComponent <RectTransform>().sizeDelta = new Vector2(initSize.x, initSize.y); hasMoved = false; } #if UNITY_IOS || UNITY_ANDROID && !UNITY_EDITOR StartCoroutine("SetInputPositionBack"); #endif }
////////////////////////////////////////////////////////////////////////// void Update() { // Wait for the accessibility manager to stop speaking if (m_WaitingForSilence == 0) { if (!UAP_AccessibilityManager.IsSpeaking()) { m_WaitingForSilence = 1; } return; } if (m_WaitingForSilence == 1) { m_WaitingForSilence = 2; // play sound and announce game done if (GameWon) { m_AudioPlayer.PlayOneShot(m_GameWon); } else { m_AudioPlayer.PlayOneShot(m_GameLost); } UAP_AccessibilityManager.Say(GameWon ? "Game Won!" : "Game Over!", false, true, UAP_AudioQueue.EInterrupt.All); // unblock the input UAP_AccessibilityManager.BlockInput(false); UAP_AccessibilityManager.PauseAccessibility(false); } }
public void PageDeActivatedHandler() { if (gameObject.name == UIB_PageManager.CurrentPage.name) { try { UAP_AccessibilityManager.GetCurrentFocusObject().gameObject.GetComponent <UAP_BaseElement>().enabled = false; } catch (Exception e) { if (e.GetType() == typeof(NullReferenceException)) { } } } if (GetComponent <AccessibleUIGroupRoot>() != null) { GetComponent <AccessibleUIGroupRoot>().m_Priority = 0; } StartCoroutine(ResetUAP(false)); if (UIB_Page.ActivatedPages.Count > 0) { // print("REMOVING " + transform.name); UIB_Page.ActivatedPages.Remove(transform); } }
public void OnDragUpdateDelegate(PointerEventData data) { // Ignore these in accessibility mode if (UAP_AccessibilityManager.IsEnabled()) { return; } Vector2 direction = (data.position - data.pressPosition).normalized; EVecDir dir = GetVectorDirection(direction); if (IsSameTile(data.pointerEnter)) { dir = EVecDir.None; } if (dir == m_LastPreviewDir) { return; } m_LastPreviewDir = dir; // Preview drag if (dir != EVecDir.None) { gameplay.Instance.PreviewDrag(m_Index, GetNeighbourIndex(dir)); } else { gameplay.Instance.CancelPreview(); } }
IEnumerator SpeakText(string textToSpeak) { #if (UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX) // Replace quotation marks textToSpeak = textToSpeak.Replace('"', '\''); int speechRate = (int)((UAP_AccessibilityManager.GetSpeechRate() / 100.0f) * 175 * 2); string parameters = "-r " + speechRate + " " + '"' + textToSpeak + '"'; m_VoiceProcess = new System.Diagnostics.Process(); m_VoiceProcess.StartInfo.FileName = "say"; m_VoiceProcess.StartInfo.Arguments = parameters; m_VoiceProcess.StartInfo.CreateNoWindow = true; m_VoiceProcess.StartInfo.RedirectStandardOutput = true; m_VoiceProcess.StartInfo.RedirectStandardError = true; m_VoiceProcess.StartInfo.UseShellExecute = false; m_VoiceProcess.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8; System.Threading.Thread worker = new System.Threading.Thread(() => WaitForVoiceToFinish(m_VoiceProcess)) { Name = "UAP_TTS_Proc" }; worker.Start(); do { yield return(null); } while (worker.IsAlive); worker = null; m_IsSpeaking = false; m_VoiceProcess = null; #endif yield break; }
////////////////////////////////////////////////////////////////////////// public bool DrawSpeechOutputSection() { EditorGUILayout.Separator(); EditorGUILayout.Separator(); m_AllowVoiceOver = serializedObject.FindProperty("m_AllowVoiceOver"); m_ReadType = serializedObject.FindProperty("m_ReadType"); m_CustomHint = serializedObject.FindProperty("m_CustomHint"); m_Hint = serializedObject.FindProperty("m_Hint"); m_HintIsLocalizationKey = serializedObject.FindProperty("m_HintIsLocalizationKey"); showSpeechOutput = DrawSectionHeader("Speech Output", showSpeechOutput); if (showSpeechOutput) { EditorGUILayout.PropertyField(m_AllowVoiceOver, new GUIContent("Allow VoiceOver (iOS)", "On iOS you can prevent this element from being read aloud with VoiceOver and read it with the regular speech synthesizer instead. See the documentation for examples of when this can be useful.")); EditorGUILayout.PropertyField(m_ReadType, new GUIContent("Read Type", "In some special circumstances you might want to prevent the type from being read. See the documentation for examples.")); EditorGUILayout.PropertyField(m_CustomHint, new GUIContent("Custom Hint Text", "Short description of what this control does. By default the plugin will read out a text fitting to the type of the element.")); if (m_CustomHint.boolValue) { ++EditorGUI.indentLevel; EditorGUILayout.PropertyField(m_Hint, new GUIContent("Hint Text", "Specify a custom hint text to be read if the user stays on this element for a few seconds.")); EditorGUILayout.PropertyField(m_HintIsLocalizationKey, new GUIContent("Is Localization Key", "If checked, the plugin will treat the hint text as a localization key and request a translation from the localization system at runtime.")); // Display localized text if needed if (m_HintIsLocalizationKey.boolValue) { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.TextArea(UAP_AccessibilityManager.Localize(m_Hint.stringValue), myTextAreaInputStyle); EditorGUI.EndDisabledGroup(); } --EditorGUI.indentLevel; } } return(showSpeechOutput); }
private void OnTouchWhileInputSelected(Touch[] touches, int taps) { if (!GetInputField().isFocused) { return; } if (touches.Length == 1) { string newText = ""; string fullText = ""; InputField inputField = GetInputField(); if (inputField != null) { newText = inputField.text; } #if ACCESS_NGUI UIInput element = GetNGUIInputField(); if (element != null) { newText = element.value; } #endif fullText = newText; UAP_AccessibilityManager.Say(fullText); deltaText = fullText; inputField.Select(); inputField.caretPosition = fullText.Length; } }
////////////////////////////////////////////////////////////////////////// private void OnTextUpdated() { // Reset cursor blinking m_CursorBlinkTimer = m_CursorBlinkDuration; if (m_ShiftModeActive) { if (m_CurrentKeyboardPage == EKeyboardPage.Letters) { OnShiftKeyPressed(); } else { m_ShiftModeActive = false; } } // Notify listener if (m_OnChangeListener != null) { m_OnChangeListener.Invoke(m_EditedText); } // Repeat typed word if in default mode if (m_KeyboardMode == EKeyboardMode.Default) { UAP_AccessibilityManager.Say(m_EditedText); } }
private void TapCountHandler(int touches, int taps) { var fingers = touches; if (fingers == 2 && taps == 2) { // UAP_AccessibilityManager.StopSpeaking(); UAP_AccessibilityManager.Say(" \n\r"); GameObject.Find("Accessibility Manager").GetComponent <UAP_AccessibilityManager>().SayPause(.1f); #if UNITY_IOS && !UNITY_EDITOR Debug.Log("ios"); iOSTTS.StopSpeaking(); iOSTTS.StopSpeaking(); iOSTTS.Shutdown(); iOSTTS.Shutdown(); #endif } if (fingers == 3 && taps == 1) { // Debug.Log("repeating from " + UAP_AccessibilityManager.GetCurrentFocusObject().name); // UAP_AccessibilityManager.Say(UAP_AccessibilityManager.GetCurrentFocusObject().GetComponent<UAP_BaseElement>().m_); UAP_AccessibilityManager.GetCurrentFocusObject().GetComponent <UAP_BaseElement>().SelectItem(true); } }
////////////////////////////////////////////////////////////////////////// public void OnShiftKeyPressed() { // On the numbers page, this key leads to symbols // On the symbols page, this key leads to numbers // On the letters page, this key toggles upper case/lower case switch (m_CurrentKeyboardPage) { case EKeyboardPage.Numbers: SetSymbolsLayout(); break; case EKeyboardPage.Symbols: SetNumbersLayout(); break; case EKeyboardPage.Letters: default: // #UAP_Keyboard_Backlog Support hold mode (⇧ --> ⇪) - find out how this is activated in accessibility mode (double tap otherwise) m_ShiftModeActive = !m_ShiftModeActive; m_ShiftSymbol.color = m_ShiftModeActive ? Color.white : (Color)(new Color32(50, 50, 50, 255)); UAP_AccessibilityManager.Say(UAP_AccessibilityManager.Localize_Internal(m_ShiftModeActive ? "Keyboard_ShiftOn" : "Keyboard_ShiftOff")); SetLettersLayout(); break; } }
////////////////////////////////////////////////////////////////////////// protected override string GetMainText() { if (!m_TryToReadLabel) { if (IsNameLocalizationKey()) { return(UAP_AccessibilityManager.Localize(m_Text)); } return(m_Text); } Text label = GetLabel(); if (label != null) { if (IsNameLocalizationKey()) { return(CombinePrefix(UAP_AccessibilityManager.Localize(label.text))); } else { return(CombinePrefix(label.text)); } } #if ACCESS_NGUI UILabel nGUILabel = GetNGUILabel(); if (nGUILabel != null) { if (IsNameLocalizationKey()) { return(CombinePrefix(UAP_AccessibilityManager.Localize(nGUILabel.text))); } else { return(CombinePrefix(nGUILabel.text)); } } #endif string fromTMPLabel = GetTextFromTextMeshPro(GetTextMeshLabel()); if (!string.IsNullOrEmpty(fromTMPLabel)) { if (IsNameLocalizationKey()) { return(CombinePrefix(UAP_AccessibilityManager.Localize(fromTMPLabel))); } else { return(CombinePrefix(fromTMPLabel)); } } if (IsNameLocalizationKey()) { return(UAP_AccessibilityManager.Localize(m_Text)); } return(m_Text); }
/// <summary> /// Add a face with a name specified as input into the dictionary. /// </summary> /// <param name="faceName"></param> /// <param name="inputImg"></param> /// <returns> bool </returns> public bool AddFace(string faceName, Texture2D inputImg) { //handle duplicate key exception if (StoredFaces.serializedDict.ContainsKey(faceName)) { onInputNameDuplicate?.Invoke(); //Debug.LogError("Duplicate name in faces dictionary"); UAP_AccessibilityManager.Say("Το όνομα υπάρχει ήδη στην βάση. Η προσθήκη απέτυχε."); return(false); } //extract face embeddings from image. var embeddings = ExtractEmbeddings(inputImg); if (embeddings != null) { StoredFaces.serializedDict.Add(faceName, embeddings); SaveStoredFaces(); UAP_AccessibilityManager.Say($"Το οικείο πρόσωπο {faceName} αποθηκέυτηκε επιτυχώς."); return(true); } else { //Debug.LogError($"Error occured in saving face with name {faceName}"); UAP_AccessibilityManager.Say("Δεν εντοπίστηκε πρόσωπο. Η προσθήκη απέτυχε."); return(false); } }
void StopAudio() { if (m_AudioPlayer.isPlaying) { m_AudioPlayer.Stop(); m_AudioPlayer.clip = null; } #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN if (UAP_AccessibilityManager.UseWindowsTTS()) { WindowsTTS.Stop(); } #elif (UNITY_STANDALONE_OSX || UNITY_EDITOR) && !UNITY_WEBPLAYER if (UAP_AccessibilityManager.UseMacOSTTS()) { MacOSTTS.instance.Stop(); } #elif UNITY_ANDROID if (UAP_AccessibilityManager.UseAndroidTTS()) { m_TTS_SpeakingTimer = 0.0f; AndroidTTS.StopSpeaking(); } #elif UNITY_IOS if (UAP_AccessibilityManager.UseiOSTTS()) { m_TTS_SpeakingTimer = 0.0f; iOSTTS.StopSpeaking(); } #endif }
public override async void ProcessScreenShotAsync() { scenarioCase = Enums.ScenarioCases.tour; annotationProccessBusy = true; resultTextPanel.text = "Επεξεργασία φωτογραφίας"; // reference to the texture object. processedTex = new Texture2D(0, 0); processedTex = await GetScreenShot(); while (!textureReceived) { await frameBreak; } DetectObjects(processedTex); SetDisplayImage(processedTex); SetResultLogs(processedTex); if (String.IsNullOrEmpty(text_result)) { text_result = "Δεν αναγνωρίστηκε, ξαναπροσπαθήστε."; } UAP_AccessibilityManager.Say(text_result); EventCamManager.onProcessEnded?.Invoke(); annotationProccessBusy = false; inferenceComplete = false; textureReceived = false; await Resources.UnloadUnusedAssets(); GC.Collect(); }
////////////////////////////////////////////////////////////////////////// public void ValueChangeCheck() { string newText = ""; string fullText = ""; InputField inputField = GetInputField(); if (inputField != null) { newText = inputField.text; } #if ACCESS_NGUI UIInput element = GetNGUIInputField(); if (element != null) { newText = element.value; } #endif fullText = newText; // Remove the previous text from the string to get just the new bits if (newText.StartsWith(deltaText)) { newText = newText.Substring(deltaText.Length); } if (newText.Length > 0) { UAP_AccessibilityManager.Say(newText); } deltaText = fullText; }
////////////////////////////////////////////////////////////////////////// private void UpdateToggleState() { if (UAP_AccessibilityManager.IsEnabled() != IsChecked()) { SetToggleState(UAP_AccessibilityManager.IsEnabled()); } }
////////////////////////////////////////////////////////////////////////// public override bool IsElementActive() { // Return whether this button is usable, and visible if (!base.IsElementActive()) { return(false); } if (m_ReferenceElement != null) { if (!m_ReferenceElement.gameObject.activeInHierarchy) { return(false); } } if (!UAP_AccessibilityManager.GetSpeakDisabledInteractables()) { if (!IsInteractable()) { return(false); } } return(true); }
public void PageActivatedHandler() { if (AssetBundleRequired && !UIB_PageManager.InternetActive) { //TODO:REfactor this //if internet is necessary and we haven't downloaded the required files. do not allow access to this page /* * var tmpLastPage = UIB_PageManager.LastPage; * var go = GameObject.Find("InternetFileError_Page").GetComponent<UIB_Page>(); * go.StartCoroutine("MoveScreenIn", false); * StartCoroutine("MoveScreenOut", true); * UIB_PageManager.LastPage = tmpLastPage; * return; */ } //Say the newly selected element when the page loads if (UAP_AccessibilityManager.IsActive()) { StartCoroutine("SayNewItem"); } if (ActivateUAPOnEnter) { StartCoroutine(ResetUAP(true)); } if (!UIB_Page.ActivatedPages.Contains(transform)) { UIB_Page.ActivatedPages.Add(transform); } }
void Start() { if (UAP_AccessibilityManager.IsEnabled()) { return; } EventSystem.current.SetSelectedGameObject(StartSelect); }