|
|
@ -12,6 +12,9 @@ namespace Fungus |
|
|
|
protected Text textUI; |
|
|
|
protected Text textUI; |
|
|
|
protected InputField inputField; |
|
|
|
protected InputField inputField; |
|
|
|
protected TextMesh textMesh; |
|
|
|
protected TextMesh textMesh; |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
protected TMPro.TMP_Text tmpro; |
|
|
|
|
|
|
|
#endif |
|
|
|
protected Component textComponent; |
|
|
|
protected Component textComponent; |
|
|
|
protected PropertyInfo textProperty; |
|
|
|
protected PropertyInfo textProperty; |
|
|
|
protected IWriterTextDestination writerTextDestination; |
|
|
|
protected IWriterTextDestination writerTextDestination; |
|
|
@ -28,6 +31,9 @@ namespace Fungus |
|
|
|
textUI = go.GetComponent<Text>(); |
|
|
|
textUI = go.GetComponent<Text>(); |
|
|
|
inputField = go.GetComponent<InputField>(); |
|
|
|
inputField = go.GetComponent<InputField>(); |
|
|
|
textMesh = go.GetComponent<TextMesh>(); |
|
|
|
textMesh = go.GetComponent<TextMesh>(); |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
tmpro = go.GetComponent<TMPro.TMP_Text>(); |
|
|
|
|
|
|
|
#endif |
|
|
|
writerTextDestination = go.GetComponent<IWriterTextDestination>(); |
|
|
|
writerTextDestination = go.GetComponent<IWriterTextDestination>(); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -35,6 +41,9 @@ namespace Fungus |
|
|
|
textUI = go.GetComponentInChildren<Text>(); |
|
|
|
textUI = go.GetComponentInChildren<Text>(); |
|
|
|
inputField = go.GetComponentInChildren<InputField>(); |
|
|
|
inputField = go.GetComponentInChildren<InputField>(); |
|
|
|
textMesh = go.GetComponentInChildren<TextMesh>(); |
|
|
|
textMesh = go.GetComponentInChildren<TextMesh>(); |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
tmpro = go.GetComponentInChildren<TMPro.TMP_Text>(); |
|
|
|
|
|
|
|
#endif |
|
|
|
writerTextDestination = go.GetComponentInChildren<IWriterTextDestination>(); |
|
|
|
writerTextDestination = go.GetComponentInChildren<IWriterTextDestination>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -74,7 +83,14 @@ namespace Fungus |
|
|
|
textMesh.richText = true; |
|
|
|
textMesh.richText = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(writerTextDestination != null) |
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
if(tmpro != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tmpro.richText = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (writerTextDestination != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
writerTextDestination.ForceRichText(); |
|
|
|
writerTextDestination.ForceRichText(); |
|
|
|
} |
|
|
|
} |
|
|
@ -97,6 +113,12 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
textMesh.color = textColor; |
|
|
|
textMesh.color = textColor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
else if (tmpro != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tmpro.color = textColor; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
else if (writerTextDestination != null) |
|
|
|
else if (writerTextDestination != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
writerTextDestination.SetTextColor(textColor); |
|
|
|
writerTextDestination.SetTextColor(textColor); |
|
|
@ -126,6 +148,12 @@ namespace Fungus |
|
|
|
tempColor.a = textAlpha; |
|
|
|
tempColor.a = textAlpha; |
|
|
|
textMesh.color = tempColor; |
|
|
|
textMesh.color = tempColor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
else if (tmpro != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tmpro.alpha = textAlpha; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
else if (writerTextDestination != null) |
|
|
|
else if (writerTextDestination != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
writerTextDestination.SetTextAlpha(textAlpha); |
|
|
|
writerTextDestination.SetTextAlpha(textAlpha); |
|
|
@ -134,7 +162,11 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
public bool HasTextObject() |
|
|
|
public bool HasTextObject() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return (textUI != null || inputField != null || textMesh != null || textComponent != null || writerTextDestination != null); |
|
|
|
return (textUI != null || inputField != null || textMesh != null || textComponent != null || |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
tmpro !=null || |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
writerTextDestination != null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public bool SupportsRichText() |
|
|
|
public bool SupportsRichText() |
|
|
@ -151,6 +183,12 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
return textMesh.richText; |
|
|
|
return textMesh.richText; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
if (tmpro != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
if (writerTextDestination != null) |
|
|
|
if (writerTextDestination != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return writerTextDestination.SupportsRichText(); |
|
|
|
return writerTextDestination.SupportsRichText(); |
|
|
@ -178,6 +216,12 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
return textMesh.text; |
|
|
|
return textMesh.text; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
else if (tmpro != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return tmpro.text; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
else if (textProperty != null) |
|
|
|
else if (textProperty != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return textProperty.GetValue(textComponent, null) as string; |
|
|
|
return textProperty.GetValue(textComponent, null) as string; |
|
|
@ -204,6 +248,12 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
textMesh.text = value; |
|
|
|
textMesh.text = value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_2018_1_OR_NEWER |
|
|
|
|
|
|
|
else if (tmpro != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tmpro.text = value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
else if (textProperty != null) |
|
|
|
else if (textProperty != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
textProperty.SetValue(textComponent, value, null); |
|
|
|
textProperty.SetValue(textComponent, value, null); |
|
|
|