The BaseMessageTextEffect
class is an abstract class that extends the BaseMeshEffect
class. It is decorated with the RequireComponent
attribute, which automatically adds the required Text
component when a script instance is added to a GameObject.
Here is the class declaration:
[RequireComponent(typeof(Text))]
public abstract class BaseMessageTextEffect : BaseMeshEffect
The main method in this class is MessageModifyMesh
. It is an abstract method that modifies the vertices of the text mesh. Here is the method signature:
public abstract void MessageModifyMesh(ref List<UIVertex> stream);
The ModifyMesh
method is overridden in this class. It checks if the effect is active and if the language is not Korean, then modifies the mesh accordingly:
public override void ModifyMesh(VertexHelper vh)
{
if (!this.IsActive())
{
return;
}
if (GSStatic.global_work_.language == Language.KOREA)
{
return;
}
List<UIVertex> list = ListPool<UIVertex>.Get();
vh.GetUIVertexStream(list);
this.MessageModifyMesh(ref list);
vh.Clear();
vh.AddUIVertexTriangleStream(list);
ListPool<UIVertex>.Release(list);
}
The class also contains several helper methods like GetCenterPosition
and GetUpperPosition
that calculate the center and upper positions of a vertex:
protected Vector2 GetCenterPosition(int index, List<UIVertex> ui_vertext_list)
{
return Vector2.Lerp(ui_vertext_list[index].position, ui_vertext_list[index + 3].position, 0.5f);
}
protected Vector2 GetUpperPosition(int index, List<UIVertex> ui_vertext_list)
{
return Vector2.Lerp(ui_vertext_list[index].position, ui_vertext_list[index + 1].position, 0.5f);
}
And finally, the class contains a protected field text_
of type Text
and a constant CHARACTER_VERTEX_MAX
set to 6:
protected const int CHARACTER_VERTEX_MAX = 6;
protected Text text_;