private void TypeText(string text, TextTyperConfig config, float printDelay, int skipChars, int printAmount) { CleanupCoroutine(); // Remove all existing TextAnimations // TODO - Would be better to pool/reuse these components foreach (var anim in GetComponents <TextAnimation>()) { Destroy(anim); } this.defaultConfig = config ? config : this.config; ProcessCustomTags(text, printDelay > 0 ? printDelay : GetPrintDelay()); if (skipChars < 0) { skipChars = 0; } if (printAmount < 1) { printAmount = GetPrintAmount(); } this.typeTextCoroutine = StartCoroutine(TypeTextCharByChar(text, skipChars, printAmount)); }
private void Resume(TextTyperConfig config, float printDelay, int skipChars, int printAmount) { if (skipChars >= this.taglessText.Length) { return; } CleanupCoroutine(); this.defaultConfig = config ? config : this.config; ProcessCustomTags(printDelay > 0 ? printDelay : GetPrintDelay()); if (skipChars < 0) { skipChars = 0; } if (printAmount < 1) { printAmount = GetPrintAmount(); } this.typeTextCoroutine = StartCoroutine(ResumeTypingTextCharByChar(skipChars, printAmount)); }
/// <summary> /// Resume the typing. /// </summary> /// <param name="config">The alternated config. If null the <see cref="TextTyper.config"/> will be used.</param> /// <param name="skipChars">The number of characters to be already typed initially.</param> public void Resume(TextTyperConfig config, int?skipChars = null) { Resume(config, -1f, skipChars ?? this.PrintedCharacters, -1); }
/// <summary> /// Types the text into the Text component character by character, using the specified (optional) print delay per character. /// </summary> /// <param name="text">Text to type.</param> /// <param name="config">The alternated config. If null the <see cref="TextTyper.config"/> will be used.</param> /// <param name="skipChars">The number of characters to be already typed initially.</param> public void TypeText(string text, TextTyperConfig config, int skipChars = 0) { TypeText(text, config, -1f, skipChars, -1); }