Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Fargrove on August 26, 2014, 01:23:48 AM

Title: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
Post by: Fargrove on August 26, 2014, 01:23:48 AM
I am trying to use the NGUI TypewriterEffect on a label that is populated with dynamic text.  Is this possible?  I can only seem to get it to work with a Label whose text is prepolulated.

Thanks in advance.
Title: Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
Post by: ArenMook on August 26, 2014, 03:30:23 AM
You can, but you need to ResetToBeginning() the typewriter after setting the text.
Title: Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
Post by: Fargrove on September 23, 2014, 01:56:37 PM
The TypewriterEffect is working great for animating dynamic text thank you.  One thing that we came across was that if we had any BBCode characters at the end of a string that we were using the TypewriterEffect to animate we would get an index-out-of-range error.  We fixed this by adding the following if statement to the while (mCurrentOffset < mFullText.Length && mNextChar <= RealTime.time) in the Update() function:

if (mCurrentOffset >= mFullText.Length)
{
      break;
}


Can you please add this fix to the TypewriterEffect.cs in the  next version of NGUI.

Thank you.
Title: Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
Post by: ArenMook on September 24, 2014, 01:13:55 PM
I assume this goes after the while loop?
  1. while (NGUIText.ParseSymbol(mFullText, ref mCurrentOffset)) { }
Title: Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
Post by: Fargrove on September 24, 2014, 04:32:38 PM
Yes I have it right after the while loop.


         while (NGUIText.ParseSymbol(mFullText, ref mCurrentOffset)) { }
         ++mCurrentOffset;

            if (mCurrentOffset >= mFullText.Length)
            {
                break;
            }



Title: Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
Post by: ArenMook on September 25, 2014, 06:55:14 PM
Got it, thanks.