Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
SoftShadow.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3using UnityEngine.UI;
4
5[AddComponentMenu("UI/ToJ Effects/Soft Shadow", 3)]
6[RequireComponent(typeof(Text))]
7public class SoftShadow : Shadow
8{
9 [SerializeField]
10 private float m_BlurSpread = 1f;
11
12 [SerializeField]
14
15 private List<UIVertex> m_Verts = new List<UIVertex>();
16
17 public float blurSpread
18 {
19 get
20 {
21 return m_BlurSpread;
22 }
23 set
24 {
25 m_BlurSpread = value;
26 if (base.graphic != null)
27 {
28 base.graphic.SetVerticesDirty();
29 }
30 }
31 }
32
34 {
35 get
36 {
38 }
39 set
40 {
42 if (base.graphic != null)
43 {
44 base.graphic.SetVerticesDirty();
45 }
46 }
47 }
48
49 protected SoftShadow()
50 {
51 }
52
53 public override void ModifyMesh(VertexHelper vh)
54 {
55 if (!IsActive())
56 {
57 return;
58 }
59 vh.GetUIVertexStream(m_Verts);
60 int count = m_Verts.Count;
61 Text component = GetComponent<Text>();
62 int num = 0;
63 int num2 = m_Verts.Count;
65 {
66 num = m_Verts.Count - component.cachedTextGenerator.characterCountVisible * 6;
67 num2 = component.cachedTextGenerator.characterCountVisible * 6;
68 }
69 Color color = base.effectColor;
70 color.a /= 4f;
71 int start = num;
72 int count2 = m_Verts.Count;
73 ApplyShadowZeroAlloc(m_Verts, color, start, m_Verts.Count, base.effectDistance.x, base.effectDistance.y);
74 for (int i = -1; i <= 1; i++)
75 {
76 for (int j = -1; j <= 1; j++)
77 {
78 if (i != 0 || j != 0)
79 {
80 start = count2;
81 count2 = m_Verts.Count;
82 ApplyShadowZeroAlloc(m_Verts, color, start, m_Verts.Count, base.effectDistance.x + (float)i * blurSpread, base.effectDistance.y + (float)j * blurSpread);
83 }
84 }
85 }
87 {
88 List<UIVertex> range = m_Verts.GetRange(0, count - num2);
89 m_Verts.RemoveRange(0, count - num2);
90 m_Verts.InsertRange(m_Verts.Count - num2, range);
91 }
92 if (component.material.shader == Shader.Find("Text Effects/Fancy Text"))
93 {
94 for (int k = 0; k < m_Verts.Count - count; k++)
95 {
96 UIVertex value = m_Verts[k];
97 value.uv1 = new Vector2(0f, 0f);
98 m_Verts[k] = value;
99 }
100 }
101 vh.Clear();
102 vh.AddUIVertexTriangleStream(m_Verts);
103 }
104}
bool onlyInitialCharactersDropShadow
Definition: SoftShadow.cs:34
float blurSpread
Definition: SoftShadow.cs:18
List< UIVertex > m_Verts
Definition: SoftShadow.cs:15
bool m_OnlyInitialCharactersDropShadow
Definition: SoftShadow.cs:13
override void ModifyMesh(VertexHelper vh)
Definition: SoftShadow.cs:53
float m_BlurSpread
Definition: SoftShadow.cs:10