Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Mosframe.DynamicScrollView Class Reference
Inheritance diagram for Mosframe.DynamicScrollView:
Mosframe.DynamicHScrollView Mosframe.DynamicVScrollView

Public Types

enum  Direction { Vertical , Horizontal }
 

Public Member Functions

void scrollToLastPos ()
 
void scrollByItemIndex (int itemIndex)
 
void refresh ()
 
void Build ()
 
void Update ()
 
void OnResize ()
 
void resizeContent ()
 
virtual void init ()
 

Public Attributes

int totalItemCount
 
RectTransform itemPrototype
 
UIDynamicList dynamicList
 
LinkedList< DSVRowcontainers = new LinkedList<DSVRow>()
 
int prevTotalItemCount = -1
 
RectTransform contentRect
 

Protected Member Functions

override void Awake ()
 
virtual void clear ()
 

Protected Attributes

Direction direction
 
float prevAnchoredPosition
 
int nextInsertItemNo
 
ScrollRect scrollRect
 
RectTransform viewportRect
 

Properties

abstract float contentAnchoredPosition [get, set]
 
abstract float contentSize [get]
 
abstract float viewportSize [get]
 
abstract float itemSize [get]
 

Private Member Functions

void updateItem (int index, DSVRow itemObj)
 

Detailed Description

Definition at line 10 of file DynamicScrollView.cs.

Member Enumeration Documentation

◆ Direction

Enumerator
Vertical 
Horizontal 

Definition at line 12 of file DynamicScrollView.cs.

Member Function Documentation

◆ Awake()

override void Mosframe.DynamicScrollView.Awake ( )
inlineprotected

◆ Build()

void Mosframe.DynamicScrollView.Build ( )
inline

Definition at line 94 of file DynamicScrollView.cs.

95 {
96 itemPrototype.gameObject.SetActive(value: false);
97 int num = (int)(viewportSize / itemSize) + 3;
98 for (int i = containers.Count; i < num; i++)
99 {
100 RectTransform rectTransform = UnityEngine.Object.Instantiate(itemPrototype);
101 rectTransform.SetParent(contentRect, worldPositionStays: false);
102 rectTransform.name = i.ToString();
103 rectTransform.anchoredPosition = ((direction == Direction.Vertical) ? new Vector2(0f, (0f - itemSize) * (float)i) : new Vector2(itemSize * (float)i, 0f));
104 DSVRow component = rectTransform.GetComponent<DSVRow>();
105 containers.AddLast(component);
106 rectTransform.gameObject.SetActive(value: true);
107 updateItem(i, component);
108 }
110 }
Definition: DSVRow.cs:7
LinkedList< DSVRow > containers
void updateItem(int index, DSVRow itemObj)

References Mosframe.DynamicScrollView.containers, Mosframe.DynamicScrollView.contentRect, Mosframe.DynamicScrollView.direction, Mosframe.DynamicScrollView.itemPrototype, Mosframe.DynamicScrollView.itemSize, Mosframe.DynamicScrollView.resizeContent(), Mosframe.DynamicScrollView.updateItem(), and Mosframe.DynamicScrollView.viewportSize.

Referenced by Mosframe.DynamicScrollView.OnResize(), UIDynamicList.Refresh(), and Mosframe.DynamicScrollView.Update().

◆ clear()

virtual void Mosframe.DynamicScrollView.clear ( )
inlineprotectedvirtual

Definition at line 272 of file DynamicScrollView.cs.

273 {
274 while (base.transform.childCount > 0)
275 {
276 UnityEngine.Object.DestroyImmediate(base.transform.GetChild(0).gameObject);
277 }
278 }

Referenced by Mosframe.DynamicScrollView.init().

◆ init()

virtual void Mosframe.DynamicScrollView.init ( )
inlinevirtual

Reimplemented in Mosframe.DynamicHScrollView, and Mosframe.DynamicVScrollView.

Definition at line 200 of file DynamicScrollView.cs.

201 {
202 clear();
203 GetComponent<RectTransform>().setFullSize();
204 ScrollRect component = GetComponent<ScrollRect>();
205 component.horizontal = direction == Direction.Horizontal;
206 component.vertical = direction == Direction.Vertical;
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);
218 if (direction == Direction.Horizontal)
219 {
220 component3.setSizeFromLeft(1f);
221 }
222 else
223 {
224 component3.setSizeFromTop(1f);
225 }
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);
231 if (direction == Direction.Horizontal)
232 {
233 component4.setSizeFromBottom(0.05f);
234 }
235 else
236 {
237 component4.setSizeFromRight(0.05f);
238 }
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);
242 if (direction == Direction.Horizontal)
243 {
244 component.horizontalScrollbar = component5;
245 }
246 else
247 {
248 component.verticalScrollbar = component5;
249 }
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;
263 if (component.GetComponent<ScrollbarHandleSize>() == null)
264 {
265 ScrollbarHandleSize scrollbarHandleSize = component.gameObject.AddComponent<ScrollbarHandleSize>();
266 scrollbarHandleSize.maxSize = 1f;
267 scrollbarHandleSize.minSize = 0.1f;
268 }
269 base.gameObject.setLayer(base.transform.parent.gameObject.layer);
270 }

References Mosframe.DynamicScrollView.clear(), Color, and Mosframe.DynamicScrollView.direction.

◆ OnResize()

void Mosframe.DynamicScrollView.OnResize ( )
inline

Definition at line 165 of file DynamicScrollView.cs.

166 {
167 Build();
168 base.transform.parent.parent.parent.RebuildLayout();
169 refresh();
170 Update();
171 GetComponent<UIScrollView>().Refresh();
172 }

References Mosframe.DynamicScrollView.Build(), Mosframe.DynamicScrollView.refresh(), and Mosframe.DynamicScrollView.Update().

Referenced by UIDynamicList.OnResizeWindow().

◆ refresh()

void Mosframe.DynamicScrollView.refresh ( )
inline

Definition at line 63 of file DynamicScrollView.cs.

64 {
65 int num = 0;
67 {
68 num = (int)((0f - contentAnchoredPosition) / itemSize);
69 }
70 foreach (DSVRow container in containers)
71 {
72 if (!(container == null) && !(container.Rect() == null))
73 {
74 float num2 = itemSize * (float)num;
75 container.Rect().anchoredPosition = ((direction == Direction.Vertical) ? new Vector2(0f, 0f - num2) : new Vector2(num2, 0f));
76 updateItem(num, container);
77 num++;
78 }
79 }
80 nextInsertItemNo = num - containers.Count;
82 }
abstract float contentAnchoredPosition

References Mosframe.DynamicScrollView.containers, Mosframe.DynamicScrollView.contentAnchoredPosition, Mosframe.DynamicScrollView.direction, Mosframe.DynamicScrollView.itemSize, Mosframe.DynamicScrollView.nextInsertItemNo, Mosframe.DynamicScrollView.prevAnchoredPosition, and Mosframe.DynamicScrollView.updateItem().

Referenced by Mosframe.DynamicScrollView.OnResize(), UIDynamicList.Scroll(), Mosframe.DynamicScrollView.scrollByItemIndex(), Mosframe.DynamicScrollView.scrollToLastPos(), and Mosframe.DynamicScrollView.Update().

◆ resizeContent()

void Mosframe.DynamicScrollView.resizeContent ( )
inline

Definition at line 174 of file DynamicScrollView.cs.

175 {
176 Vector2 size = contentRect.getSize();
177 if (direction == Direction.Vertical)
178 {
179 size.y = itemSize * (float)totalItemCount;
180 }
181 else
182 {
183 size.x = itemSize * (float)totalItemCount;
184 }
185 contentRect.setSize(size);
186 }

References Mosframe.DynamicScrollView.contentRect, Mosframe.DynamicScrollView.direction, Mosframe.DynamicScrollView.itemSize, and Mosframe.DynamicScrollView.totalItemCount.

Referenced by Mosframe.DynamicScrollView.Build(), and Mosframe.DynamicScrollView.Update().

◆ scrollByItemIndex()

void Mosframe.DynamicScrollView.scrollByItemIndex ( int  itemIndex)
inline

◆ scrollToLastPos()

◆ Update()

void Mosframe.DynamicScrollView.Update ( )
inline

Definition at line 112 of file DynamicScrollView.cs.

113 {
114 Build();
116 {
118 bool flag = false;
120 {
121 flag = true;
122 }
124 if (flag)
125 {
127 }
128 refresh();
129 }
131 {
133 LinkedListNode<DSVRow> first = containers.First;
134 if (first == null)
135 {
136 break;
137 }
138 DSVRow value = first.Value;
139 containers.RemoveFirst();
140 containers.AddLast(value);
141 float num = itemSize * (float)(containers.Count + nextInsertItemNo);
142 value.Rect().anchoredPosition = ((direction == Direction.Vertical) ? new Vector2(0f, 0f - num) : new Vector2(num, 0f));
143 updateItem(containers.Count + nextInsertItemNo, value);
145 }
147 {
149 LinkedListNode<DSVRow> last = containers.Last;
150 if (last != null)
151 {
152 DSVRow value2 = last.Value;
153 containers.RemoveLast();
154 containers.AddFirst(value2);
156 float num2 = itemSize * (float)nextInsertItemNo;
157 value2.Rect().anchoredPosition = ((direction == Direction.Vertical) ? new Vector2(0f, 0f - num2) : new Vector2(num2, 0f));
159 continue;
160 }
161 break;
162 }
163 }

References Mosframe.DynamicScrollView.Build(), Mosframe.DynamicScrollView.containers, Mosframe.DynamicScrollView.contentAnchoredPosition, Mosframe.DynamicScrollView.contentSize, Mosframe.DynamicScrollView.direction, Mosframe.DynamicScrollView.itemSize, Mosframe.DynamicScrollView.nextInsertItemNo, Mosframe.DynamicScrollView.prevAnchoredPosition, Mosframe.DynamicScrollView.prevTotalItemCount, Mosframe.DynamicScrollView.refresh(), Mosframe.DynamicScrollView.resizeContent(), Mosframe.DynamicScrollView.totalItemCount, Mosframe.DynamicScrollView.updateItem(), and Mosframe.DynamicScrollView.viewportSize.

Referenced by Mosframe.DynamicScrollView.OnResize(), UIDynamicList.Refresh(), and Mosframe.DynamicScrollView.scrollByItemIndex().

◆ updateItem()

void Mosframe.DynamicScrollView.updateItem ( int  index,
DSVRow  itemObj 
)
inlineprivate

Definition at line 188 of file DynamicScrollView.cs.

189 {
190 if (index < 0 || index >= totalItemCount)
191 {
192 itemObj.SetActive(enable: false);
193 return;
194 }
195 itemObj.SetActive(enable: true);
196 dynamicList.UpdateRow(itemObj, index);
197 }
void UpdateRow(DSVRow dsvRow, int index)

References Mosframe.DynamicScrollView.dynamicList, Mosframe.DynamicScrollView.totalItemCount, and UIDynamicList.UpdateRow().

Referenced by Mosframe.DynamicScrollView.Build(), Mosframe.DynamicScrollView.refresh(), and Mosframe.DynamicScrollView.Update().

Member Data Documentation

◆ containers

◆ contentRect

RectTransform Mosframe.DynamicScrollView.contentRect

◆ direction

◆ dynamicList

UIDynamicList Mosframe.DynamicScrollView.dynamicList

Definition at line 22 of file DynamicScrollView.cs.

Referenced by Mosframe.DynamicScrollView.updateItem().

◆ itemPrototype

RectTransform Mosframe.DynamicScrollView.itemPrototype

◆ nextInsertItemNo

int Mosframe.DynamicScrollView.nextInsertItemNo
protected

◆ prevAnchoredPosition

float Mosframe.DynamicScrollView.prevAnchoredPosition
protected

◆ prevTotalItemCount

int Mosframe.DynamicScrollView.prevTotalItemCount = -1

◆ scrollRect

ScrollRect Mosframe.DynamicScrollView.scrollRect
protected

Definition at line 35 of file DynamicScrollView.cs.

Referenced by Mosframe.DynamicScrollView.Awake().

◆ totalItemCount

◆ viewportRect

RectTransform Mosframe.DynamicScrollView.viewportRect
protected

Definition at line 37 of file DynamicScrollView.cs.

Referenced by Mosframe.DynamicScrollView.Awake().

Property Documentation

◆ contentAnchoredPosition

abstract float Mosframe.DynamicScrollView.contentAnchoredPosition
getset

◆ contentSize

abstract float Mosframe.DynamicScrollView.contentSize
get

◆ itemSize

abstract float Mosframe.DynamicScrollView.itemSize
getprotected

◆ viewportSize

abstract float Mosframe.DynamicScrollView.viewportSize
get

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