//This method is used to get a new item, and the new item is a clone from the prefab named itemPrefabName.
        //This method is usually used in onGetItemByItemIndex.
        public LoopStaggeredGridViewItem NewListViewItem(string itemPrefabName)
        {
            StaggeredGridItemPool pool = null;

            if (mItemPoolDict.TryGetValue(itemPrefabName, out pool) == false)
            {
                return(null);
            }
            LoopStaggeredGridViewItem item = pool.GetItem();
            RectTransform             rf   = item.GetComponent <RectTransform>();

            rf.SetParent(mContainerTrans);
            rf.localScale         = Vector3.one;
            rf.anchoredPosition3D = Vector3.zero;
            rf.localEulerAngles   = Vector3.zero;
            item.ParentListView   = this;
            return(item);
        }
Example #2
0
        public LoopStaggeredGridViewItem NewListViewItem(string itemPrefabName)
        {
            StaggeredGridItemPool staggeredGridItemPool = (StaggeredGridItemPool)null;

            if (!this.mItemPoolDict.TryGetValue(itemPrefabName, out staggeredGridItemPool))
            {
                return((LoopStaggeredGridViewItem)null);
            }
            LoopStaggeredGridViewItem staggeredGridViewItem = staggeredGridItemPool.GetItem();
            RectTransform             component             = (RectTransform)((Component)staggeredGridViewItem).GetComponent <RectTransform>();

            ((Transform)component).SetParent((Transform)this.mContainerTrans);
            ((Transform)component).set_localScale(Vector3.get_one());
            component.set_anchoredPosition3D(Vector3.get_zero());
            ((Transform)component).set_localEulerAngles(Vector3.get_zero());
            staggeredGridViewItem.ParentListView = this;
            return(staggeredGridViewItem);
        }