LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index) { Debug.Log(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"); ListItem3 itemScript = item.GetComponent <ListItem3>(); 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"); ListItem3 component = (ListItem3)((Component)loopListViewItem2).GetComponent <ListItem3>(); if (!loopListViewItem2.IsInitHandlerCalled) { loopListViewItem2.IsInitHandlerCalled = true; component.Init(); } component.SetItemData(itemDataByIndex, index); return(loopListViewItem2); }