IEnumerator UpdateTypingMessageWithFadeTMP(string message) { var textMeshProTypingEffect = new TMP_RubyTextTypingEffect( RichTextBuilder.Parse(message).ToStringWithRuby(), textMeshProRubyForTypingMessageWithFade !, textMeshProRubyTypingEffect !, textMeshProBodyTypingEffects !); while (true) { var startedTime = Time.time; while (true) { var elapsedTime = Time.time - startedTime; textMeshProTypingEffect.Update(elapsedTime); if (elapsedTime > textMeshProTypingEffect.duration) { break; } yield return(null); } yield return(new WaitForSeconds(1f)); } }
void ShowStringWithRubyTMP(string message) { var richText = RichTextBuilder.Parse(message).ToStringWithRuby(); textMeshProBody !.text = richText.body; textMeshProRuby !.Set(richText); }
IEnumerator UpdateTypingMessageWithFade(string text) { var stringWithRuby = RichTextBuilder.Parse(text) .WrapWithHyphenation(body !, new HyphenationJpns.Ruler()) .ToStringWithRuby(); var typingEffect = new RubyTextTypingEffect(stringWithRuby, rubyForTypingMessageWithFade !, rubyTypingEffect !, bodyTypingEffects !); while (true) { var startedTime = Time.time; while (true) { var elapsedTime = Time.time - startedTime; typingEffect.Update(elapsedTime); if (elapsedTime > typingEffect.duration) { break; } yield return(null); } yield return(new WaitForSeconds(1f)); } }
void ShowStringWithRuby(string text) { var wrapped = RichTextBuilder.Parse(text) .WrapWithHyphenation(body !, new HyphenationJpns.Ruler()) .ToStringWithRuby(); ruby !.Set(wrapped); body !.text = wrapped.body; }
IEnumerator UpdateTypingMessage(string text) { var richText = RichTextBuilder.Parse(text) .WrapWithHyphenation(body !, new HyphenationJpns.Ruler()); while (true) { for (int i = 0; i < richText.body.Length; ++i) { if (richText.body[i] == '\n') { continue; } var sub = richText.Substring(0, i + 1).ToStringWithRuby(); rubyForTypingMessage !.Set(sub); bodyForTypingMessage !.text = sub.body; yield return(new WaitForSeconds(0.05f)); } yield return(new WaitForSeconds(1f)); } }
IEnumerator UpdateTypingMessageTMP(string message) { var richText = RichTextBuilder.Parse(message); var stringWithRuby = richText.ToStringWithRuby(); textMeshProBodyForTypingMessage !.Modifier.Text.text = stringWithRuby.body; while (true) { for (int i = 0; i < richText.body.Length; ++i) { if (richText.body[i] == '\n') { continue; } textMeshProBodyForTypingMessage.visibleQuadCount = i + 1; // var sub = richText.Substring(0, i + 1).ToStringWithRuby(); // textMeshProRubyForTypingMessage.Set(sub); yield return(new WaitForSeconds(0.05f)); } yield return(new WaitForSeconds(1f)); } }