Support => NGUI 3 Support => Topic started by: genericdeveloper on October 09, 2015, 03:51:33 AM
Title: TypeWriterEffect Always Active When Using Color or URL
Post by: genericdeveloper on October 09, 2015, 03:51:33 AM
Hey there,
This is primarily targeted @ArenMook, but also to anyone who can assist me.
I am using the TypeWriterEffect class in order to create custom speech bubbles for my game. I have a function that is built around determining if the TypeWriterEffect "HasFinishedDisplayingText".
publicbool HasFinishedDisplayingText(){
bool hasFinishedDisplayingText =true;
if(IsInUse()){
if(labelTypeWriterEffect !=null){
if(labelTypeWriterEffect.isActive){
hasFinishedDisplayingText =false;
}
}
}
return hasFinishedDisplayingText;
}
This worked perfectly fine for a few months. However a design constraint occurred where I need to add a URL to the SpeechBubble UILabel text in order to have it drive users to an offer.
Previously when I relied on this function it would correctly determine the state of the TypeWriterText as having finished or not, but now when I use a test string that has a URL or color configured, it persists in being in the mActive state indefinitely. The test string being used is:
[url=http://google.com]Test[/url]
More so what's interesting is that the UILabel itself will populate its text up to a certain point and doesn't seem to proceed past the closing bracket.
What I end up seeing for the UILabel text during game play is:
[url=http://google.com]Test
I've been staring at the TypeWriterEffect code all day and I cannot seem to identify where there miscommunication is occurring. I do not understand why it "breaks" the second I add a URL to it.
My question is this:
Is there a better way to determine if the TypeWriterEffect has finished?
Is there a way to rectify the parsing for the TypeWriterEffect so that it will include the terminating [/url] or [-]?
Is there anything I may be overlooking in this effort?
I appreciate any input as I'm at my wits end and don't see any real alternatives.
Also in order to help provide more clarity, I have attached the TypeWriterEffect script that I'm using.
Best Regards.
Title: Re: TypeWriterEffect Always Active When Using Color or URL
Post by: ArenMook on October 10, 2015, 11:36:49 PM
I think your NGUI isn't up to date. I just did a simple test by making a new scene with a label containing the text you pasted, and the TypewriterEffect on it works fine, calling its OnFinished as expected.
Title: Re: TypeWriterEffect Always Active When Using Color or URL
Post by: genericdeveloper on October 11, 2015, 06:28:31 PM
@ArenMook
Hey. That is a distinct possibility. I have chosen not to update NGUI as I'm at the tail end of a project. However to clarify I've identified that this is an interesting corner case for the version of NGUI I'm using (I don't have the version number on me).
Basically if you have a string that is Test (http://blah.com). It will always return mActive=true indefinitely. However if I add a space or another character before or after that string it works.
So, there is a work around, but it's also possible you've identified and resolved this error in your updates.