예제 #1
0
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0 || index >= mFilteredDataList.Count)
            {
                return(null);
            }

            CustomData2 itemData = mFilteredDataList[index];

            if (itemData == null)
            {
                return(null);
            }
            //get a new item. Every item can use a different prefab, the parameter of the NewListViewItem is the prefab’name.
            //And all the prefabs should be listed in ItemPrefabList in LoopListView2 Inspector Setting
            LoopListViewItem2 item       = listView.NewListViewItem("ItemPrefab1");
            ListItem16        itemScript = item.GetComponent <ListItem16>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            itemScript.mNameText.text = itemData.mContent;
            return(item);
        }
예제 #2
0
        private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0 || index >= this.mDataList.Count)
            {
                return((LoopListViewItem2)null);
            }
            CustomData mData = this.mDataList[index];

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

            if (!loopListViewItem2.IsInitHandlerCalled)
            {
                loopListViewItem2.IsInitHandlerCalled = true;
                component.Init();
            }
            component.mNameText.set_text(mData.mContent);
            return(loopListViewItem2);
        }