frame8.Logic.Misc.Visual.UI.ScrollRectItemsAdapter Namespace |
| Class | Description | |
|---|---|---|
| AbstractViewHolder | ||
| AbstractViewsHolder |
Class representing the concept of a Views Holder, i.e. a class that references some views and the id of the data displayed by those views.
Usually, the root and its child views, once created, don't change, but ItemIndex does, after which the views will change their data.
| |
| BaseItemViewsHolder | The minimal implementation of a Views Holder that can be used with SRIATParams, TItemViewsHolder | |
| BaseParams | Input params to be passed to Init This can be used Monobehaviour's field and exposed via inspector (most common case) Or can be manually constructed, depending on what's easier in your context | |
| BaseParamsWithPrefab |
Custom params containing a single prefab. ItemPrefabSize is calculated on first accessing and invalidated each time InitIfNeeded(ISRIA) is called.
| |
| ItemsDescriptor | ||
| ReadOnlyAttribute | ||
| ScrollRectItemsAdapter8TParams, TItemViewsHolder | ||
| Snapper8 |
Script that enables snapping on a ScrollRect. It's used in conjuction with a SRIATParams, TItemViewsHolder. Attach it to the ScrollRect game object.
| |
| SRIATParams, TItemViewsHolder | Old name: ScrollRectItemsAdapter8 (renamed in v3.0 to SRIA) Base abstract component that you need to extend in order to provide an implementation for CreateViewsHolder(Int32) and UpdateViewsHolder(TItemViewsHolder). Should be attached to the GameObject containing the ScrollRect to be optimized. Any views holder should extend BaseItemViewsHolder, so you can provide it as the generic parameter TItemViewsHolder when implementing SRIA. Extending BaseParams is optional. Based on your needs. Provide it as generic parameter TParams when implementing SRIA How it works, in a nutshell (it's recommended to manually go through the example code in order to fully understand the mechanism): 1. create your own implementation of BaseItemViewsHolder, let's name it MyItemViewsHolder 2. create your own implementation of BaseParams (if needed), let's name it MyParams 3. create your own implementation of SRIA<MyParams, MyItemViewsHolder>, let's name it MyScrollRectItemsAdapter 4. instantiate MyScrollRectItemsAdapter 5. call MyScrollRectItemsAdapter.ResetItemsCount(int) once (and any time your dataset is changed) and the following things will happen: 5.1. CollectItemsSizes(ItemCountChangeMode, Int32, Int32, ItemsDescriptor) will be called (which you can optionally implement to provide your own sizes, if known beforehand) 5.2. CreateViewsHolder(Int32) will be called for enough items to fill the viewport. Once a ViewsHolder is created, it'll be re-used when it goes off-viewport - newOrRecycledViewsHolder.root will be null, so you need to instantiate your prefab, assign it and call newOrRecycledViewsHolder.CollectViews(). Alternatively, you can call its Init(GameObject, Int32, Boolean, Boolean) method, which can do a lot of things for you, mainly instantiate the prefab and (if you want) call CollectViews() for you - after creation, only UpdateViewsHolder(TItemViewsHolder) will be called for it when its represented item changes and becomes visible 5.3. UpdateViewsHolder(TItemViewsHolder) will be called when an item is to be displayed or simply needs updating: - use ItemIndex to get the item index, so you can retrieve its associated model from your data set (most common practice is to store the data list in your Params implementation) - root is not null here (given the views holder was properly created in CreateViewsHolder(..)). It's assigned a valid object whose UI elements only need their values changed (common practice is to implement helper methods in the views holder that take the model and update the views themselves) ResetItems(Int32, Boolean, Boolean) is also called when the viewport's size changes (like for orientation changes on mobile or window resizing on sandalone platforms) *NOTE: No LayoutGroup (vertical/horizontal/grid) on content panel are allowed, since all the layouting is delegated to this adapter | |
| SRIADebugger | ||
| SRIAStandaloneInputModule | Required if building for UWP (WSA), but recommended in all cases: Replace your StandaloneInputModule with this one. If you have your own input module, then see ISRIAPointerInputModule | |
| SRIATouchInputModule | Required if building for UWP (WSA), but recommended in all cases: Replace your TouchInputModule(if exists) with this one. | |
| Utils |
| Interface | Description | |
|---|---|---|
| ISRIA |
Contains commonly used members so that an SRIATParams, TItemViewsHolder instance
can be referenced abstractly (since instances of derived generic classes cannot be referenced by a variable of base type).
| |
| ISRIAPointerInputModule |
Used if you have your own custom input module. Otherwise, see SRIAStandaloneInputModule and SRIATouchInputModule.
Required if building for UWP (WSA), but recommended in all cases: your InputModule should implement this interface and return the "PointerInputModule.m_PointerData" field (like SRIAStandaloneInputModule does) |
| Enumeration | Description | |
|---|---|---|
| BaseParamsContentGravity | Represents how often or when the optimizer does his core loop: checking for any items that need to be created, destroyed, disabled, displayed, recycled | |
| BaseParamsUpdateMode | Represents how often or when the optimizer does his core loop: checking for any items that need to be created, destroyed, disabled, displayed, recycled | |
| ItemCountChangeMode |