2using System.Collections.Generic;
4using UnityEngine.EventSystems;
9[RequireComponent(typeof(ScrollRect))]
26 public LinkedList<DSVRow>
containers =
new LinkedList<DSVRow>();
72 if (!(container ==
null) && !(container.Rect() ==
null))
75 container.Rect().anchoredPosition = ((
direction ==
Direction.Vertical) ?
new Vector2(0f, 0f - num2) :
new Vector2(num2, 0f));
90 contentRect.anchoredPosition = Vector2.zero;
100 RectTransform rectTransform = UnityEngine.Object.Instantiate(
itemPrototype);
101 rectTransform.SetParent(
contentRect, worldPositionStays:
false);
102 rectTransform.name = i.ToString();
104 DSVRow component = rectTransform.GetComponent<
DSVRow>();
106 rectTransform.gameObject.SetActive(value:
true);
133 LinkedListNode<DSVRow> first =
containers.First;
138 DSVRow value = first.Value;
142 value.Rect().anchoredPosition = ((
direction ==
Direction.Vertical) ?
new Vector2(0f, 0f - num) :
new Vector2(num, 0f));
149 LinkedListNode<DSVRow> last =
containers.Last;
152 DSVRow value2 = last.Value;
157 value2.Rect().anchoredPosition = ((
direction ==
Direction.Vertical) ?
new Vector2(0f, 0f - num2) :
new Vector2(num2, 0f));
168 base.transform.parent.parent.parent.RebuildLayout();
171 GetComponent<UIScrollView>().Refresh();
192 itemObj.SetActive(enable:
false);
195 itemObj.SetActive(enable:
true);
199 [ContextMenu(
"Initialize")]
203 GetComponent<RectTransform>().setFullSize();
204 ScrollRect component = GetComponent<ScrollRect>();
207 component.scrollSensitivity = 15f;
208 RectTransform component2 =
new GameObject(
"Viewport", typeof(RectTransform), typeof(Mask), typeof(Image)).GetComponent<RectTransform>();
209 component2.SetParent(component.transform, worldPositionStays:
false);
210 component2.setFullSize();
211 component2.offsetMin =
new Vector2(10f, 10f);
212 component2.offsetMax =
new Vector2(-10f, -10f);
213 component2.GetComponent<Image>().type = Image.Type.Sliced;
214 component2.GetComponent<Mask>().showMaskGraphic =
false;
215 component.viewport = component2;
216 RectTransform component3 =
new GameObject(
"Content", typeof(RectTransform)).GetComponent<RectTransform>();
217 component3.SetParent(component2, worldPositionStays:
false);
220 component3.setSizeFromLeft(1f);
224 component3.setSizeFromTop(1f);
226 Vector2 size = component3.getSize();
227 component3.setSize(size - size * 0.06f);
228 component.content = component3;
229 RectTransform component4 =
new GameObject((
direction ==
Direction.Horizontal) ?
"Scrollbar Horizontal" :
"Scrollbar Vertical", typeof(Scrollbar), typeof(Image)).GetComponent<RectTransform>();
230 component4.SetParent(component2, worldPositionStays:
false);
233 component4.setSizeFromBottom(0.05f);
237 component4.setSizeFromRight(0.05f);
239 component4.SetParent(component.transform, worldPositionStays:
true);
240 Scrollbar component5 = component4.GetComponent<Scrollbar>();
241 component5.direction = ((
direction !=
Direction.Horizontal) ? Scrollbar.Direction.BottomToTop : Scrollbar.Direction.LeftToRight);
244 component.horizontalScrollbar = component5;
248 component.verticalScrollbar = component5;
250 Image component6 = component4.GetComponent<Image>();
251 component6.color =
new Color(0.1f, 0.1f, 0.1f, 0.5f);
252 component6.type = Image.Type.Sliced;
253 RectTransform component7 =
new GameObject(
"Sliding Area", typeof(RectTransform)).GetComponent<RectTransform>();
254 component7.SetParent(component4, worldPositionStays:
false);
255 component7.setFullSize();
256 RectTransform component8 =
new GameObject(
"Handle", typeof(Image)).GetComponent<RectTransform>();
257 component8.SetParent(component7, worldPositionStays:
false);
258 component8.setFullSize();
259 Image component9 = component8.GetComponent<Image>();
260 component9.color =
new Color(0.5f, 0.5f, 1f, 0.5f);
261 component9.type = Image.Type.Sliced;
262 component5.handleRect = component8;
266 scrollbarHandleSize.maxSize = 1f;
267 scrollbarHandleSize.minSize = 0.1f;
269 base.gameObject.setLayer(base.transform.parent.gameObject.layer);
274 while (base.transform.childCount > 0)
276 UnityEngine.Object.DestroyImmediate(base.transform.GetChild(0).gameObject);
void UpdateRow(DSVRow dsvRow, int index)