Browse Source

Add PuncPause and NotifyGlyph to TMPro Writer

Fix #845
master
Steve Halliwell 4 years ago
parent
commit
7a40c2f829
  1. 9
      Assets/Fungus/Scripts/Components/Writer.cs
  2. 14
      Assets/Fungus/Scripts/Utils/TextAdapter.cs

9
Assets/Fungus/Scripts/Components/Writer.cs

@ -585,6 +585,15 @@ namespace Fungus
textAdapter.RevealedCharacters++;
NotifyGlyph();
//TODO need to log some info here, it's not a perf spike
// Punctuation pause
if (IsPunctuation(textAdapter.LastRevealedCharacter))
{
yield return StartCoroutine(DoWait(currentPunctuationPause));
}
if (currentWritingSpeed > 0f)
{
timeAccumulator -= invWritingSpeed;

14
Assets/Fungus/Scripts/Utils/TextAdapter.cs

@ -233,6 +233,20 @@ namespace Fungus
}
}
public char LastRevealedCharacter
{
get
{
#if UNITY_2018_1_OR_NEWER
if(tmpro != null)
{
return tmpro.textInfo.characterInfo[tmpro.maxVisibleCharacters].character;
}
#endif
return (char)0;
}
}
public int CharactersToReveal
{
get

Loading…
Cancel
Save