void DisplayText(Database.LocalizationData data, float _duration = 3) { this.StopAllCoroutines(); textTween.Kill(); TextUI.text = ""; var localizedText = LocalizationManager.GetTranslation(data.Id); if (string.IsNullOrEmpty(localizedText)) { this.gameObject.SetActive(false); return; } this.gameObject.SetActive(true); if (WalkieTalkie.IsShown) { WalkieTalkie.Pulse(); } TextUI.text = string.IsNullOrEmpty(localizedText) ? data.Id : ReverseText(ArabicFixer.Fix(localizedText)); if (AppManager.I.AppSettings.EnglishSubtitles) { TextUItranslation.text = string.IsNullOrEmpty(localizedText) ? data.Id : data.GetSubtitleTranslation(); } this.StartCoroutine(DisplayTextCoroutine(_duration)); //Debug.Log("DisplayText() " + data + " - " + data.English); }
public void PlayDialog(Database.LocalizationData data, bool isKeeper = true, bool autoClose = true, System.Action _callback = null) { if (autoClose) { WidgetSubtitles.I.DisplaySentence(data, 2, isKeeper, null); currentCallback = _callback; AudioManager.I.PlayDialogue(data, () => { CloseDialog(); if (currentCallback != null) { currentCallback(); } }); } else { WidgetSubtitles.I.DisplaySentence(data, 2, true, null); AudioManager.I.PlayDialogue(data, _callback); } }
/// <summary> /// Activate view elements if SentenceId != "" and display sentence. /// </summary> public void DisplaySentence(Database.LocalizationData data, float _duration = 2, bool _isKeeper = false, System.Action _callback = null) { if (!AppManager.I.AppSettings.SubtitlesEnabled) { return; } GlobalUI.Init(); this.StopAllCoroutines(); currentCallback = _callback; showTween.PlayForward(); if (_isKeeper) { bgColorTween.PlayBackwards(); } else { bgColorTween.PlayForward(); } WalkieTalkie.Show(_isKeeper); DisplayText(data, _duration); }