Author Topic: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text  (Read 3922 times)

Fargrove

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
« 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
« Reply #1 on: August 26, 2014, 03:30:23 AM »
You can, but you need to ResetToBeginning() the typewriter after setting the text.

Fargrove

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
« Reply #3 on: September 24, 2014, 01:13:55 PM »
I assume this goes after the while loop?
  1. while (NGUIText.ParseSymbol(mFullText, ref mCurrentOffset)) { }

Fargrove

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
« Reply #4 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;
            }




ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can I Use NGUI TypewriterEffect On A Label With Dynamic Text
« Reply #5 on: September 25, 2014, 06:55:14 PM »
Got it, thanks.