Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
CurveEffect Class Reference
Inheritance diagram for CurveEffect:

Public Types

enum  CurveMode { TextArea , FullRect }
 

Public Member Functions

override void ModifyMesh (VertexHelper vh)
 

Protected Member Functions

 CurveEffect ()
 

Properties

AnimationCurve curve [get, set]
 
float strength [get, set]
 

Private Attributes

CurveMode m_CurveMode
 
AnimationCurve m_Curve = new AnimationCurve(new Keyframe(0f, 0f, 0f, 2f), new Keyframe(1f, 0f, -2f, 0f))
 
float m_Strength = 1f
 
List< UIVertex > m_Verts = new List<UIVertex>()
 

Detailed Description

Definition at line 7 of file CurveEffect.cs.

Member Enumeration Documentation

◆ CurveMode

Enumerator
TextArea 
FullRect 

Definition at line 9 of file CurveEffect.cs.

Constructor & Destructor Documentation

◆ CurveEffect()

CurveEffect.CurveEffect ( )
inlineprotected

Definition at line 64 of file CurveEffect.cs.

65 {
66 }

Member Function Documentation

◆ ModifyMesh()

override void CurveEffect.ModifyMesh ( VertexHelper  vh)
inline

Definition at line 68 of file CurveEffect.cs.

69 {
70 if (!IsActive())
71 {
72 return;
73 }
74 vh.GetUIVertexStream(m_Verts);
75 if (m_Verts.Count == 0)
76 {
77 return;
78 }
79 Vector2 zero = Vector2.zero;
80 Vector2 zero2 = Vector2.zero;
81 if (m_CurveMode == CurveMode.FullRect)
82 {
83 Rect rect = GetComponent<RectTransform>().rect;
84 zero = new Vector2(rect.xMin, rect.yMax);
85 zero2 = new Vector2(rect.xMax, rect.yMin);
86 }
87 else
88 {
89 zero = m_Verts[0].position;
90 zero2 = m_Verts[m_Verts.Count - 1].position;
91 for (int i = 0; i < m_Verts.Count; i++)
92 {
93 if (m_Verts[i].position.x < zero.x)
94 {
95 zero.x = m_Verts[i].position.x;
96 }
97 if (m_Verts[i].position.y > zero.y)
98 {
99 zero.y = m_Verts[i].position.y;
100 }
101 if (m_Verts[i].position.x > zero2.x)
102 {
103 zero2.x = m_Verts[i].position.x;
104 }
105 if (m_Verts[i].position.y < zero2.y)
106 {
107 zero2.y = m_Verts[i].position.y;
108 }
109 }
110 }
111 float num = zero2.x - zero.x;
112 for (int j = 0; j < m_Verts.Count; j++)
113 {
114 UIVertex value = m_Verts[j];
115 value.position.y += curve.Evaluate((value.position.x - zero.x) / num) * strength;
116 m_Verts[j] = value;
117 }
118 vh.Clear();
119 vh.AddUIVertexTriangleStream(m_Verts);
120 }
float strength
Definition: CurveEffect.cs:46
List< UIVertex > m_Verts
Definition: CurveEffect.cs:24
AnimationCurve curve
Definition: CurveEffect.cs:27
CurveMode m_CurveMode
Definition: CurveEffect.cs:16

References curve, m_CurveMode, m_Verts, and strength.

Member Data Documentation

◆ m_Curve

AnimationCurve CurveEffect.m_Curve = new AnimationCurve(new Keyframe(0f, 0f, 0f, 2f), new Keyframe(1f, 0f, -2f, 0f))
private

Definition at line 19 of file CurveEffect.cs.

◆ m_CurveMode

CurveMode CurveEffect.m_CurveMode
private

Definition at line 16 of file CurveEffect.cs.

Referenced by ModifyMesh().

◆ m_Strength

float CurveEffect.m_Strength = 1f
private

Definition at line 22 of file CurveEffect.cs.

◆ m_Verts

List<UIVertex> CurveEffect.m_Verts = new List<UIVertex>()
private

Definition at line 24 of file CurveEffect.cs.

Referenced by ModifyMesh().

Property Documentation

◆ curve

AnimationCurve CurveEffect.curve
getset

Definition at line 26 of file CurveEffect.cs.

27 {
28 get
29 {
30 return m_Curve;
31 }
32 set
33 {
34 if (m_Curve != value)
35 {
36 m_Curve = value;
37 if (base.graphic != null)
38 {
39 base.graphic.SetVerticesDirty();
40 }
41 }
42 }
43 }
AnimationCurve m_Curve
Definition: CurveEffect.cs:19

Referenced by ModifyMesh().

◆ strength

float CurveEffect.strength
getset

Definition at line 45 of file CurveEffect.cs.

46 {
47 get
48 {
49 return m_Strength;
50 }
51 set
52 {
53 if (m_Strength != value)
54 {
55 m_Strength = value;
56 if (base.graphic != null)
57 {
58 base.graphic.SetVerticesDirty();
59 }
60 }
61 }
62 }
float m_Strength
Definition: CurveEffect.cs:22

Referenced by ModifyMesh().


The documentation for this class was generated from the following file: