forked from hunterzonewu/unity-decompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayoutElement.cs
More file actions
227 lines (207 loc) · 5.55 KB
/
LayoutElement.cs
File metadata and controls
227 lines (207 loc) · 5.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// Decompiled with JetBrains decompiler
// Type: UnityEngine.UI.LayoutElement
// Assembly: UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 2216A18B-AF52-44A5-85A0-A1CAA19C1090
// Assembly location: C:\Users\Blake\sandbox\unity\test-project\Library\UnityAssemblies\UnityEngine.UI.dll
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
/// <summary>
/// <para>Add this component to a GameObject to make it into a layout element or override values on an existing layout element.</para>
/// </summary>
[ExecuteInEditMode]
[AddComponentMenu("Layout/Layout Element", 140)]
[RequireComponent(typeof (RectTransform))]
public class LayoutElement : UIBehaviour, ILayoutElement, ILayoutIgnorer
{
[SerializeField]
private float m_MinWidth = -1f;
[SerializeField]
private float m_MinHeight = -1f;
[SerializeField]
private float m_PreferredWidth = -1f;
[SerializeField]
private float m_PreferredHeight = -1f;
[SerializeField]
private float m_FlexibleWidth = -1f;
[SerializeField]
private float m_FlexibleHeight = -1f;
[SerializeField]
private bool m_IgnoreLayout;
/// <summary>
/// <para>Should this RectTransform be ignored by the layout system?</para>
/// </summary>
public virtual bool ignoreLayout
{
get
{
return this.m_IgnoreLayout;
}
set
{
if (!SetPropertyUtility.SetStruct<bool>(ref this.m_IgnoreLayout, value))
return;
this.SetDirty();
}
}
/// <summary>
/// <para>The minimum width this layout element may be allocated.</para>
/// </summary>
public virtual float minWidth
{
get
{
return this.m_MinWidth;
}
set
{
if (!SetPropertyUtility.SetStruct<float>(ref this.m_MinWidth, value))
return;
this.SetDirty();
}
}
/// <summary>
/// <para>The minimum height this layout element may be allocated.</para>
/// </summary>
public virtual float minHeight
{
get
{
return this.m_MinHeight;
}
set
{
if (!SetPropertyUtility.SetStruct<float>(ref this.m_MinHeight, value))
return;
this.SetDirty();
}
}
/// <summary>
/// <para>The preferred width this layout element should be allocated if there is sufficient space.</para>
/// </summary>
public virtual float preferredWidth
{
get
{
return this.m_PreferredWidth;
}
set
{
if (!SetPropertyUtility.SetStruct<float>(ref this.m_PreferredWidth, value))
return;
this.SetDirty();
}
}
/// <summary>
/// <para>The preferred height this layout element should be allocated if there is sufficient space.</para>
/// </summary>
public virtual float preferredHeight
{
get
{
return this.m_PreferredHeight;
}
set
{
if (!SetPropertyUtility.SetStruct<float>(ref this.m_PreferredHeight, value))
return;
this.SetDirty();
}
}
/// <summary>
/// <para>The extra relative width this layout element should be allocated if there is additional available space.</para>
/// </summary>
public virtual float flexibleWidth
{
get
{
return this.m_FlexibleWidth;
}
set
{
if (!SetPropertyUtility.SetStruct<float>(ref this.m_FlexibleWidth, value))
return;
this.SetDirty();
}
}
/// <summary>
/// <para>The extra relative height this layout element should be allocated if there is additional available space.</para>
/// </summary>
public virtual float flexibleHeight
{
get
{
return this.m_FlexibleHeight;
}
set
{
if (!SetPropertyUtility.SetStruct<float>(ref this.m_FlexibleHeight, value))
return;
this.SetDirty();
}
}
/// <summary>
/// <para>Called by the layout system.</para>
/// </summary>
public virtual int layoutPriority
{
get
{
return 1;
}
}
protected LayoutElement()
{
}
/// <summary>
/// <para>Called by the layout system.</para>
/// </summary>
public virtual void CalculateLayoutInputHorizontal()
{
}
/// <summary>
/// <para>Called by the layout system.</para>
/// </summary>
public virtual void CalculateLayoutInputVertical()
{
}
protected override void OnEnable()
{
base.OnEnable();
this.SetDirty();
}
protected override void OnTransformParentChanged()
{
this.SetDirty();
}
/// <summary>
/// <para>See MonoBehaviour.OnDisable.</para>
/// </summary>
protected override void OnDisable()
{
this.SetDirty();
base.OnDisable();
}
protected override void OnDidApplyAnimationProperties()
{
this.SetDirty();
}
protected override void OnBeforeTransformParentChanged()
{
this.SetDirty();
}
/// <summary>
/// <para>Mark the LayoutElement as dirty.</para>
/// </summary>
protected void SetDirty()
{
if (!this.IsActive())
return;
LayoutRebuilder.MarkLayoutForRebuild(this.transform as RectTransform);
}
protected override void OnValidate()
{
this.SetDirty();
}
}
}