1using System.Collections.Generic;
5[AddComponentMenu(
"UI/ToJ Effects/Depth Effect", 2)]
6[RequireComponent(typeof(Text))]
30 private List<UIVertex>
m_Verts =
new List<UIVertex>();
41 if (base.graphic !=
null)
43 base.graphic.SetVerticesDirty();
59 if (base.graphic !=
null)
61 base.graphic.SetVerticesDirty();
78 if (base.graphic !=
null)
80 base.graphic.SetVerticesDirty();
95 if (base.graphic !=
null)
97 base.graphic.SetVerticesDirty();
111 if (base.graphic !=
null)
113 base.graphic.SetVerticesDirty();
122 protected void ApplyShadowZeroAlloc(List<UIVertex> verts, Color32 color,
int start,
int end,
float x,
float y,
float factor)
124 for (
int i = start; i < end; i++)
126 UIVertex uIVertex = verts[i];
128 Vector3 position = uIVertex.position;
129 position.x += x * factor;
134 position.y += y * factor;
137 position.y += depthPerspectiveStrength.y * ((m_TopLeftPos.y - position.y) /
m_OverallTextSize.y - 0.5f) * factor;
139 uIVertex.position = position;
140 Color32 color2 = color;
143 color2.a = (byte)(color2.a * verts[i].color.a / 255);
145 uIVertex.color = color2;
158 Text component = GetComponent<Text>();
163 num = m_Verts.Count - component.cachedTextGenerator.characterCountVisible * 6;
164 num2 = component.cachedTextGenerator.characterCountVisible * 6;
174 for (
int i = num; i < num + num2; i++)
178 m_TopLeftPos.x =
m_Verts[i].position.x;
182 m_TopLeftPos.y =
m_Verts[i].position.y;
186 m_BottomRightPos.x =
m_Verts[i].position.x;
190 m_BottomRightPos.y =
m_Verts[i].position.y;
210 List<UIVertex> range =
m_Verts.GetRange(0, count - num2);
211 m_Verts.RemoveRange(0, count - num2);
214 if (component.material.shader == Shader.Find(
"Text Effects/Fancy Text"))
216 for (
int j = 0; j < m_Verts.Count - count; j++)
219 value.uv1 =
new Vector2(0f, 0f);
224 vh.AddUIVertexTriangleStream(
m_Verts);
Vector2 m_DepthPerspectiveStrength
Vector2 m_EffectDirectionAndDepth
bool onlyInitialCharactersGenerateDepth
void ApplyShadowZeroAlloc(List< UIVertex > verts, Color32 color, int start, int end, float x, float y, float factor)
Vector2 m_OverallTextSize
override void ModifyMesh(VertexHelper vh)
Vector2 effectDirectionAndDepth
Vector2 depthPerspectiveStrength
bool m_OnlyInitialCharactersGenerateDepth