Esempio n. 1
0
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0 || index >= DataSourceMgr.Get.TotalItemCount)
            {
                return(null);
            }

            ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(index);

            if (itemData == null)
            {
                return(null);
            }
            LoopListViewItem2 item       = listView.NewListViewItem("ItemPrefab1");
            ListItem8         itemScript = item.GetComponent <ListItem8>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }

            //itemScript.SetItemData(itemData, index);
            return(item);
        }
        private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0 || index >= DataSourceMgr.Get.TotalItemCount)
            {
                return((LoopListViewItem2)null);
            }
            ItemData itemDataByIndex = DataSourceMgr.Get.GetItemDataByIndex(index);

            if (itemDataByIndex == null)
            {
                return((LoopListViewItem2)null);
            }
            LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab1");
            ListItem8         component         = (ListItem8)((Component)loopListViewItem2).GetComponent <ListItem8>();

            if (!loopListViewItem2.IsInitHandlerCalled)
            {
                loopListViewItem2.IsInitHandlerCalled = true;
                component.Init();
            }
            component.SetItemData(itemDataByIndex, index);
            return(loopListViewItem2);
        }