Browse Source

Merge pull request #177 from FungusGames/force-rich-text

Fixed Markup text visible if rich text not enabled #176
master
Chris Gregan 10 years ago
parent
commit
43bcc3ad11
  1. 26
      Assets/Fungus/UI/Scripts/Writer.cs
  2. 1165
      Assets/Tests/UI/TextTests.unity

26
Assets/Fungus/UI/Scripts/Writer.cs

@ -49,6 +49,9 @@ namespace Fungus
[Tooltip("Write one word at a time rather one character at a time")]
public bool writeWholeWords = false;
[Tooltip("Force the target text object to use Rich Text mode so text color and alpha appears correctly")]
public bool forceRichText = true;
/**
* This property is true when the writer is waiting for user input to continue
*/
@ -133,6 +136,24 @@ namespace Fungus
}
}
}
protected virtual void Start()
{
if (forceRichText)
{
if (textUI != null)
{
textUI.supportRichText = true;
}
// Input Field does not support rich text
if (textMesh != null)
{
textMesh.richText = true;
}
}
}
public virtual bool HasTextObject()
{
@ -555,11 +576,12 @@ namespace Fungus
string hiddenColor = String.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", c.r, c.g, c.b, c.a);
// Make right hand side text hidden
if (rightText.Length > 0)
if (SupportsRichText() &&
rightText.Length > 0)
{
tempText += "<color=" + hiddenColor + ">" + rightText + "</color>";
}
return tempText;
}

1165
Assets/Tests/UI/TextTests.unity

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save