Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ToJShadow.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3using UnityEngine.UI;
4
5[AddComponentMenu("UI/ToJ Effects/ToJ Shadow", 14)]
6public class ToJShadow : BaseMeshEffect
7{
8 [SerializeField]
9 private Color m_EffectColor = new Color(0f, 0f, 0f, 0.5f);
10
11 [SerializeField]
12 private Vector2 m_EffectDistance = new Vector2(1f, -1f);
13
14 [SerializeField]
15 private bool m_UseGraphicAlpha = true;
16
17 private List<UIVertex> m_Verts = new List<UIVertex>();
18
20 {
21 get
22 {
23 return m_EffectColor;
24 }
25 set
26 {
27 m_EffectColor = value;
28 if (base.graphic != null)
29 {
30 base.graphic.SetVerticesDirty();
31 }
32 }
33 }
34
35 public Vector2 effectDistance
36 {
37 get
38 {
39 return m_EffectDistance;
40 }
41 set
42 {
43 if (value.x > 600f)
44 {
45 value.x = 600f;
46 }
47 if (value.x < -600f)
48 {
49 value.x = -600f;
50 }
51 if (value.y > 600f)
52 {
53 value.y = 600f;
54 }
55 if (value.y < -600f)
56 {
57 value.y = -600f;
58 }
59 if (!(m_EffectDistance == value))
60 {
61 m_EffectDistance = value;
62 if (base.graphic != null)
63 {
64 base.graphic.SetVerticesDirty();
65 }
66 }
67 }
68 }
69
70 public bool useGraphicAlpha
71 {
72 get
73 {
74 return m_UseGraphicAlpha;
75 }
76 set
77 {
78 m_UseGraphicAlpha = value;
79 if (base.graphic != null)
80 {
81 base.graphic.SetVerticesDirty();
82 }
83 }
84 }
85
86 protected ToJShadow()
87 {
88 }
89
90 protected void ApplyShadowZeroAlloc(List<UIVertex> verts, Color32 color, int start, int end, float x, float y)
91 {
92 int num = verts.Count * 2;
93 if (verts.Capacity < num)
94 {
95 verts.Capacity = num;
96 }
97 for (int i = start; i < end; i++)
98 {
99 UIVertex uIVertex = verts[i];
100 verts.Add(uIVertex);
101 Vector3 position = uIVertex.position;
102 position.x += x;
103 position.y += y;
104 uIVertex.position = position;
105 Color32 color2 = color;
107 {
108 color2.a = (byte)(color2.a * verts[i].color.a / 255);
109 }
110 uIVertex.color = color2;
111 verts[i] = uIVertex;
112 }
113 }
114
115 protected void ApplyShadow(List<UIVertex> verts, Color32 color, int start, int end, float x, float y)
116 {
117 int num = verts.Count * 2;
118 if (verts.Capacity < num)
119 {
120 verts.Capacity = num;
121 }
122 ApplyShadowZeroAlloc(verts, color, start, end, x, y);
123 }
124
125 public override void ModifyMesh(VertexHelper vh)
126 {
127 if (!IsActive())
128 {
129 return;
130 }
131 vh.GetUIVertexStream(m_Verts);
132 int count = m_Verts.Count;
134 Text component = GetComponent<Text>();
135 if (component != null && component.material.shader == Shader.Find("Text Effects/Fancy Text"))
136 {
137 for (int i = 0; i < m_Verts.Count - count; i++)
138 {
139 UIVertex value = m_Verts[i];
140 value.uv1 = new Vector2(0f, 0f);
141 m_Verts[i] = value;
142 }
143 }
144 vh.Clear();
145 vh.AddUIVertexTriangleStream(m_Verts);
146 }
147}
Color effectColor
Definition: ToJShadow.cs:20
List< UIVertex > m_Verts
Definition: ToJShadow.cs:17
void ApplyShadowZeroAlloc(List< UIVertex > verts, Color32 color, int start, int end, float x, float y)
Definition: ToJShadow.cs:90
Vector2 m_EffectDistance
Definition: ToJShadow.cs:12
bool m_UseGraphicAlpha
Definition: ToJShadow.cs:15
Vector2 effectDistance
Definition: ToJShadow.cs:36
void ApplyShadow(List< UIVertex > verts, Color32 color, int start, int end, float x, float y)
Definition: ToJShadow.cs:115
Color m_EffectColor
Definition: ToJShadow.cs:9
bool useGraphicAlpha
Definition: ToJShadow.cs:71
ToJShadow()
Definition: ToJShadow.cs:86
override void ModifyMesh(VertexHelper vh)
Definition: ToJShadow.cs:125