private IEnumerator TypeTextCharByChar(string text) { this.TextComponent.text = string.Empty; var generator = new TypedTextGenerator(); TypedTextGenerator.TypedText typedText; int printedCharCount = 0; do { typedText = generator.GetTypedTextAt(text, printedCharCount, this.TextComponent); //Debug.Log(this.TextComponent.text); //this.TextComponent.text = typedText.ShownText; //Debug.Log(CheckTextWidth()); //this.TextComponent.ForceMeshUpdate(); //Debug.Log(this.TextComponent.isTextOverflowing); this.TextComponent.text = typedText.TextToPrint; //Debug.Log("Before: " + this.TextComponent.isTextOverflowing); //Debug.Log("After: " + this.TextComponent.isTextOverflowing); //Debug.Log(this.TextComponent.isTextOverflowing); //Debug.Log(this.TextComponent.firstOverflowCharacterIndex); this.OnCharacterPrinted(typedText.LastPrintedChar.ToString()); ++printedCharCount; var delay = typedText.Delay > 0 ? typedText.Delay : this.GetPrintDelayForCharacter(typedText.LastPrintedChar); yield return(new WaitForSeconds(delay)); }while (!typedText.IsComplete); this.typeTextCoroutine = null; this.OnTypewritingComplete(); }
private IEnumerator TypeTextCharByChar(string text) { this.TextComponent.text = string.Empty; var generator = new TypedTextGenerator(); TypedTextGenerator.TypedText typedText; int printedCharCount = 0; do { typedText = generator.GetTypedTextAt(text, printedCharCount); this.TextComponent.text = typedText.TextToPrint; this.OnCharacterPrinted(typedText.LastPrintedChar.ToString()); ++printedCharCount; var delay = typedText.Delay > 0 ? typedText.Delay : this.GetPrintDelayForCharacter(typedText.LastPrintedChar); yield return(new WaitForSeconds(delay)); }while (!typedText.IsComplete); this.typeTextCoroutine = null; this.OnTypewritingComplete(); }