public void ApplySettings(DialogSettings settings) { background.color = settings.backgroundColor; nextCursor.blinkSpeed = settings.cursorBlinkSpeed; if (settings.showFrame) { frame.gameObject.SetActive(true); frame.sprite = settings.frameSprite; } else { frame.gameObject.SetActive(false); } }
public static string PreprocessText(string text, DialogSettings settings) { if (settings.colorDictionary == null) { return(text); } var builder = new StringBuilder(text); foreach (var entry in settings.colorDictionary) { builder.Replace(entry.text, WrapWithColor(entry.text, entry.color)); } return(builder.ToString()); }
public void ShowDialog(IList <string> pages, DialogSettings settings = null) { if (settings == null) { settings = baseSettings; } if (state != State.OFF) { Debug.LogWarning("Dialog already active, ignoring (Did you forget to check IsDialogActive?)."); return; } if (pages.Count < 1 || pages[0].Length < 1) { Debug.LogWarning("DialogSystem: Ignoring empty text for ShowDialog()"); return; } StartCoroutine(DialogRoutine(pages, settings)); }
private IEnumerator PageRoutine(string pageText, DialogSettings settings) { // Setup the page and wait until TMP processes it. yield return(dialogBox.LoadPageAsync(pageText)); // Progressively reveal characters. Tuple <char, bool> result; while (!(result = dialogBox.Advance()).Item2) { if (settings.printSound != null) { if (settings.soundOnWhitespace || !char.IsWhiteSpace(result.Item1)) { audioSource.PlayOneShot(settings.printSound); } } yield return(new WaitForSeconds(baseSettings.dialogSpeed)); } }