Click or drag to resize

PackedGridExample Class

Advanced implementation demonstrating the usage of a GridAdapterTParams, TCellVH and a custom Views holder for the cell groups, PackedGridLayoutGroup, Which packs the cells in the smallest space possible instead of arranging them in a line. The bigger the cell group in physical size, the more accurate the packing algorithm is.
Inheritance Hierarchy
SystemObject
Object
    Component
      Behaviour
        MonoBehaviour
          Com.ForbiddenByte.OSA.CoreOSA MyGridParams, CellGroupViewsHolder MyCellViewsHolder
            Com.ForbiddenByte.OSA.CustomAdapters.GridViewGridAdapter MyGridParams, MyCellViewsHolder
              Com.ForbiddenByte.OSA.Demos.GridDifferentItemSizes PackedGridExample

Namespace: Com.ForbiddenByte.OSA.Demos.GridDifferentItemSizes
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public class PackedGridExample : GridAdapter<MyGridParams, MyCellViewsHolder>

The PackedGridExample type exposes the following members.

Constructors
Name Description
Public method PackedGridExample
Top
Properties
Name Description
Public property LazyData
Top
Methods
Name Description
Protected method GetNewCellGroupViewsHolder
Provide your own implementation of the group prefab, if you have a custom one. Most often than not, you won't use this
(Overrides GridAdapterTParams, TCellVHGetNewCellGroupViewsHolder.)
Public method Refresh (Overrides GridAdapterTParams, TCellVHRefresh(Boolean, Boolean).)
Protected method Start (Overrides OSATParams, TItemViewsHolderStart.)
Protected method UpdateCellViewsHolder
Called when a cell becomes visible
(Overrides GridAdapterTParams, TCellVHUpdateCellViewsHolder(TCellVH).)
Protected method UpdateViewsHolder
Here the grid adapter checks if new groups need to be created or if old ones need to be disabled or destroyed, after which it calls UpdateCellViewsHolder(TCellVH) for each remaining cells.

Override it (and call the base implementation!) only if you know what you're doing. If you just want to update your cells' views, do it in UpdateCellViewsHolder(TCellVH)

(Overrides GridAdapterTParams, TCellVHUpdateViewsHolder(CellGroupViewsHolderTCellVH).)
Top
Version Information

Optimized ScrollView Adapter

Supported in: 4.3
See Also