Example #1
0
        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));
            }
        }
Example #2
0
        void ShowStringWithRubyTMP(string message)
        {
            var richText = RichTextBuilder.Parse(message).ToStringWithRuby();

            textMeshProBody !.text = richText.body;
            textMeshProRuby !.Set(richText);
        }
Example #3
0
        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));
            }
        }
Example #4
0
        void ShowStringWithRuby(string text)
        {
            var wrapped = RichTextBuilder.Parse(text)
                          .WrapWithHyphenation(body !, new HyphenationJpns.Ruler())
                          .ToStringWithRuby();

            ruby !.Set(wrapped);
            body !.text = wrapped.body;
        }
Example #5
0
        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));
            }
        }
Example #6
0
        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));
            }
        }