private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0 || index > DataSourceMgr.Get.TotalItemCount)
            {
                return((LoopListViewItem2)null);
            }
            if (index == 0)
            {
                LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab0");
                this.UpdateLoadingTip(loopListViewItem2);
                return(loopListViewItem2);
            }
            int      num             = index - 1;
            ItemData itemDataByIndex = DataSourceMgr.Get.GetItemDataByIndex(num);

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

            if (!loopListViewItem2_1.IsInitHandlerCalled)
            {
                loopListViewItem2_1.IsInitHandlerCalled = true;
                component.Init();
            }
            component.SetItemData(itemDataByIndex, num);
            return(loopListViewItem2_1);
        }
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0)
            {
                return(null);
            }
            LoopListViewItem2 item = null;

            if (index == DataSourceMgr.Get.TotalItemCount)
            {
                item = listView.NewListViewItem("ItemPrefab0");
                UpdateLoadingTip(item);
                return(item);
            }
            ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(index);

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

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            if (index == DataSourceMgr.Get.TotalItemCount - 1)
            {
                item.Padding = 0;
            }
            itemScript.SetItemData(itemData, index);
            return(item);
        }
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0 || index >= ChatMsgDataSourceMgr.Get.TotalItemCount)
            {
                return(null);
            }

            ChatMsg itemData = ChatMsgDataSourceMgr.Get.GetChatMsgByIndex(index);

            if (itemData == null)
            {
                return(null);
            }
            LoopListViewItem2 item = null;

            if (itemData.mPersonId == 0)
            {
                item = listView.NewListViewItem("ItemPrefab1");
            }
            else
            {
                item = listView.NewListViewItem("ItemPrefab2");
            }
            ListItem4 itemScript = item.GetComponent <ListItem4>();

            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)
            {
                return((LoopListViewItem2)null);
            }
            if (index == DataSourceMgr.Get.TotalItemCount)
            {
                LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab0");
                if (!loopListViewItem2.IsInitHandlerCalled)
                {
                    loopListViewItem2.IsInitHandlerCalled = true;
                    // ISSUE: method pointer
                    ((UnityEvent)((ListItem11)((Component)loopListViewItem2).GetComponent <ListItem11>()).mRootButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(OnLoadMoreBtnClicked)));
                }
                this.UpdateLoadingTip(loopListViewItem2);
                return(loopListViewItem2);
            }
            ItemData itemDataByIndex = DataSourceMgr.Get.GetItemDataByIndex(index);

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

            if (!loopListViewItem2_1.IsInitHandlerCalled)
            {
                loopListViewItem2_1.IsInitHandlerCalled = true;
                component.Init();
            }
            component.SetItemData(itemDataByIndex, index);
            return(loopListViewItem2_1);
        }
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0)
            {
                return(null);
            }

            TreeViewItemCountData countData = mTreeItemCountMgr.QueryTreeItemByTotalIndex(index);

            if (countData == null)
            {
                return(null);
            }
            int treeItemIndex = countData.mTreeItemIndex;
            TreeViewItemData treeViewItemData = TreeViewDataSourceMgr.Get.GetItemDataByIndex(treeItemIndex);

            if (index == countData.mBeginIndex)
            {
                LoopListViewItem2 item       = listView.NewListViewItem("ItemPrefab1");
                ListItem12        itemScript = item.GetComponent <ListItem12>();
                if (item.IsInitHandlerCalled == false)
                {
                    item.IsInitHandlerCalled = true;
                    itemScript.Init();
                    itemScript.SetClickCallBack(this.OnExpandClicked);
                }
                item.UserIntData1     = treeItemIndex;
                item.UserIntData2     = 0;
                itemScript.mText.text = treeViewItemData.mName;
                itemScript.SetItemData(treeItemIndex, countData.mIsExpand);
                return(item);
            }
            else
            {
                int      childIndex = index - countData.mBeginIndex - 1;
                ItemData itemData   = treeViewItemData.GetChild(childIndex);
                if (itemData == null)
                {
                    return(null);
                }
                LoopListViewItem2 item       = listView.NewListViewItem("ItemPrefab2");
                ListItem13        itemScript = item.GetComponent <ListItem13>();
                if (item.IsInitHandlerCalled == false)
                {
                    item.IsInitHandlerCalled = true;
                    itemScript.Init();
                }
                item.UserIntData1 = treeItemIndex;
                item.UserIntData2 = childIndex;
                itemScript.SetItemData(itemData, treeItemIndex, childIndex);
                return(item);
            }
        }
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int row)
        {
            if (row < 0)
            {
                return(null);
            }

            LoopListViewItem2 item = null;

            if (row == 0)
            {
                item = listView.NewListViewItem("ItemPrefab0");
                UpdateLoadingTip1(item);
                return(item);
            }
            if (row == GetMaxRowCount() + 1)
            {
                item = listView.NewListViewItem("ItemPrefab1");
                UpdateLoadingTip2(item);
                return(item);
            }
            int itemRow = row - 1;

            item = listView.NewListViewItem("ItemPrefab2");
            ListItem6 itemScript = item.GetComponent <ListItem6>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            for (int i = 0; i < mItemCountPerRow; ++i)
            {
                int itemIndex = itemRow * mItemCountPerRow + i;
                if (itemIndex >= DataSourceMgr.Get.TotalItemCount)
                {
                    itemScript.mItemList[i].gameObject.SetActive(false);
                    continue;
                }
                ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(itemIndex);
                if (itemData != null)
                {
                    itemScript.mItemList[i].gameObject.SetActive(true);
                    itemScript.mItemList[i].SetItemData(itemData, itemIndex);
                }
                else
                {
                    itemScript.mItemList[i].gameObject.SetActive(false);
                }
            }
            return(item);
        }
        private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0)
            {
                return((LoopListViewItem2)null);
            }
            TreeViewItemCountData viewItemCountData = this.mTreeItemCountMgr.QueryTreeItemByTotalIndex(index);

            if (viewItemCountData == null)
            {
                return((LoopListViewItem2)null);
            }
            int mTreeItemIndex = viewItemCountData.mTreeItemIndex;
            TreeViewItemData itemDataByIndex = TreeViewDataSourceMgr.Get.GetItemDataByIndex(mTreeItemIndex);

            if (!viewItemCountData.IsChild(index))
            {
                LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab1");
                ListItem12        component         = (ListItem12)((Component)loopListViewItem2).GetComponent <ListItem12>();
                if (!loopListViewItem2.IsInitHandlerCalled)
                {
                    loopListViewItem2.IsInitHandlerCalled = true;
                    component.Init();
                    component.SetClickCallBack(new Action <int>(this.OnExpandClicked));
                }
                loopListViewItem2.UserIntData1 = mTreeItemIndex;
                loopListViewItem2.UserIntData2 = 0;
                component.mText.set_text(itemDataByIndex.mName);
                component.SetItemData(mTreeItemIndex, viewItemCountData.mIsExpand);
                return(loopListViewItem2);
            }
            int      childIndex = viewItemCountData.GetChildIndex(index);
            ItemData child      = itemDataByIndex.GetChild(childIndex);

            if (child == null)
            {
                return((LoopListViewItem2)null);
            }
            LoopListViewItem2 loopListViewItem2_1 = listView.NewListViewItem("ItemPrefab2");
            ListItem13        component1          = (ListItem13)((Component)loopListViewItem2_1).GetComponent <ListItem13>();

            if (!loopListViewItem2_1.IsInitHandlerCalled)
            {
                loopListViewItem2_1.IsInitHandlerCalled = true;
                component1.Init();
            }
            loopListViewItem2_1.UserIntData1 = mTreeItemIndex;
            loopListViewItem2_1.UserIntData2 = childIndex;
            component1.SetItemData(child, mTreeItemIndex, childIndex);
            return(loopListViewItem2_1);
        }
Beispiel #8
0
        private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int row)
        {
            if (row < 0)
            {
                return((LoopListViewItem2)null);
            }
            if (row == 0)
            {
                LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab0");
                this.UpdateLoadingTip1(loopListViewItem2);
                return(loopListViewItem2);
            }
            if (row == this.GetMaxRowCount() + 1)
            {
                LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("ItemPrefab1");
                this.UpdateLoadingTip2(loopListViewItem2);
                return(loopListViewItem2);
            }
            int num1 = row - 1;
            LoopListViewItem2 loopListViewItem2_1 = listView.NewListViewItem("ItemPrefab2");
            ListItem6         component           = (ListItem6)((Component)loopListViewItem2_1).GetComponent <ListItem6>();

            if (!loopListViewItem2_1.IsInitHandlerCalled)
            {
                loopListViewItem2_1.IsInitHandlerCalled = true;
                component.Init();
            }
            for (int index = 0; index < this.mItemCountPerRow; ++index)
            {
                int num2 = num1 * this.mItemCountPerRow + index;
                if (num2 >= DataSourceMgr.Get.TotalItemCount)
                {
                    ((Component)component.mItemList[index]).get_gameObject().SetActive(false);
                }
                else
                {
                    ItemData itemDataByIndex = DataSourceMgr.Get.GetItemDataByIndex(num2);
                    if (itemDataByIndex != null)
                    {
                        ((Component)component.mItemList[index]).get_gameObject().SetActive(true);
                        component.mItemList[index].SetItemData(itemDataByIndex, num2);
                    }
                    else
                    {
                        ((Component)component.mItemList[index]).get_gameObject().SetActive(false);
                    }
                }
            }
            return(loopListViewItem2_1);
        }
Beispiel #9
0
        LoopListViewItem2 OnGetItemByIndexForHour(LoopListView2 listView, int index)
        {
            LoopListViewItem2 item       = listView.NewListViewItem("ItemPrefab1");
            ListItem7         itemScript = item.GetComponent <ListItem7>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            int firstItemVal = 1;
            int itemCount    = 24;
            int val          = 0;

            if (index >= 0)
            {
                val = index % itemCount;
            }
            else
            {
                val = itemCount + ((index + 1) % itemCount) - 1;
            }
            val = val + firstItemVal;
            itemScript.Refresh(index, val);
            return(item);
        }
Beispiel #10
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);
        }
Beispiel #11
0
        LoopListViewItem2 OnGetItemByIndexForMonth(LoopListView2 listView, int index)
        {
            LoopListViewItem2 item       = listView.NewListViewItem("ItemPrefab1");
            ListItem7         itemScript = item.GetComponent <ListItem7>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            int firstItemVal = 1;
            int itemCount    = 12;
            int val          = 0;

            if (index >= 0)
            {
                val = index % itemCount;
            }
            else
            {
                val = itemCount + ((index + 1) % itemCount) - 1;
            }
            val = val + firstItemVal;
            itemScript.Value      = val;
            itemScript.mText.text = mMonthNameArray[val - 1];
            return(item);
        }
Beispiel #12
0
    private LoopListViewItem2 OnGetMinItemByIndex(LoopListView2 listView, int index)
    {
        LoopListViewItem2 item       = listView.NewListViewItem(ItemNameList[0]);
        LevelLimitItem    itemScript = item.GetComponent <LevelLimitItem>();

        if (item.IsInitHandlerCalled == false)
        {
            item.IsInitHandlerCalled = true;
            itemScript.Init();
        }
        int firstItemVal = 1;
        int itemCount    = MaxLevel;
        int val          = 0;

        if (index >= 0)
        {
            val = index % itemCount;
        }
        else
        {
            val = itemCount + ((index + 1) % itemCount) - 1;
        }
        val = val + firstItemVal;
        itemScript.Level = val;
        itemScript.SetData(val.ToString());
        LoopListViewMax.RefreshAllShownItem();
        return(item);
    }
    protected override LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
    {
        if (index < 0 || index >= DataManger.TotalItemCount)
        {
            return(null);
        }
        GridItemData itemData = DataManger.GetItemDataByIndex(index);

        if (itemData == null)
        {
            return(null);
        }
        LoopListViewItem2 item = listView.NewListViewItem(ItemName);

        for (int i = 0; i < row; i++)
        {
            int             itemIndex  = index * row + i;
            UIGameLevelItem itemScript = item.transform.GetChild(i).GetComponent <UIGameLevelItem>();
            if (itemIndex >= DataManger.TotalDataCount)
            {
                itemScript.gameObject.SetActive(false);
                continue;
            }
            else
            {
                itemScript.gameObject.SetActive(true);
            }
            itemScript.Init();
            m_TransferDataList[itemIndex].ActionOneIntCallBack = CallBack;
            m_TransferDataList[itemIndex].ObjArray             = new object[] { itemScript };
            itemScript.SetData(m_TransferDataList[itemIndex]);
        }
        return(item);
    }
    protected override LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
    {
        if (index < 0 || index >= DataManger.TotalItemCount)
        {
            return(null);
        }
        GridItemData itemData = DataManger.GetItemDataByIndex(index);

        if (itemData == null)
        {
            return(null);
        }
        LoopListViewItem2 item = listView.NewListViewItem(ItemName);

        EquipItem itemScript = item.GetComponent <EquipItem>();

        itemScript.Init();
        itemScript.SetData(index, UnityEngine.Random.Range(1, 6), SpriteArray[UnityEngine.Random.Range(0, SpriteArray.Length)].name, UnityEngine.Random.Range(0, 2) == 1,
                           UnityEngine.Random.Range(1, 1000), UnityEngine.Random.Range(1, 6));
        itemScript.GetComponent <Button>().onClick.RemoveAllListeners();
        itemScript.GetComponent <Button>().onClick.AddListener(delegate
        {
            Debug.Log(itemScript.Index);
        });

        return(item);
    }
Beispiel #15
0
    private LoopListViewItem2 OnGetItem1(LoopListView2 loopList, int index)
    {
        if (index < 0 || index >= dataNum)
        {
            return(null);
        }

        var data = new Item1Data()
        {
            HeadColor = Mathf.CorrelatedColorTemperatureToRGB(40000 * index / 20f),
            Desc      = $"#R这是第{index}个Item的描述,表情啊#{index},哈哈哈哈哈#{index}#{index}#{index}#{index}"
        };

        var item = loopList.NewListViewItem("Item1");

        if (!item.IsInitHandlerCalled)
        {
            var script = item.GetComponent <Item1Script>();
            item.UserObjectData = script;
            script.Init();
        }

        var item1Script = (Item1Script)item.UserObjectData;

        item1Script.SetData(data);
        return(item);
    }
        /// <summary>
        /// 無限スクロールを更新する
        /// TODO 未完成 あとでいい感じに実装する
        /// </summary>
        /// <typeparam name="TExtensionInfiniteScroll"></typeparam>
        /// <param name="view"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        private LoopListViewItem2 OnUpdateInfiniteScroll <TExtensionInfiniteScroll>(LoopListView2 view, int index)
            where TExtensionInfiniteScroll : IExtensionInfiniteScrollItem
        {
            var itemObj = view.NewListViewItem(view.ItemPrefabDataList.First().mItemPrefab.name);

            return(itemObj);
        }
        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);
            }
            //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");
            ListItem2         itemScript = item.GetComponent <ListItem2>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            itemScript.SetItemData(itemData, index);
            return(item);
        }
Beispiel #18
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");
            ListItem2         itemScript = item.GetComponent <ListItem2>();

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

            itemScript.SetItemData(itemData, index);
            itemScript.GetComponent <Button>().onClick.RemoveAllListeners();
            itemScript.GetComponent <Button>().onClick.AddListener(delegate
            {
                Debug.Log(index);
            });
            return(item);
        }
        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 rowIndex)
        {
            if (rowIndex < 0)
            {
                return((LoopListViewItem2)null);
            }
            LoopListViewItem2 loopListViewItem2 = listView.NewListViewItem("RowPrefab");
            ListItem15        component         = (ListItem15)((Component)loopListViewItem2).GetComponent <ListItem15>();

            if (!loopListViewItem2.IsInitHandlerCalled)
            {
                loopListViewItem2.IsInitHandlerCalled = true;
                component.Init();
            }
            for (int index = 0; index < 3; ++index)
            {
                int num = rowIndex * 3 + index;
                if (num >= this.mItemTotalCount)
                {
                    ((Component)component.mItemList[index]).get_gameObject().SetActive(false);
                }
                else
                {
                    ((Component)component.mItemList[index]).get_gameObject().SetActive(true);
                    component.mItemList[index].mNameText.set_text("Item" + (object)num);
                }
            }
            return(loopListViewItem2);
        }
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0)
            {
                return(null);
            }
            LoopListViewItem2 item       = listView.NewListViewItem("ItemPrefab1");
            ListItem6         itemScript = item.GetComponent <ListItem6>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            for (int i = 0; i < mItemCountPerRow; ++i)
            {
                int itemIndex = index * mItemCountPerRow + i;
                if (itemIndex >= mListItemTotalCount)
                {
                    itemScript.mItemList[i].gameObject.SetActive(false);
                    continue;
                }
                ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(itemIndex);
                if (itemData != null)
                {
                    itemScript.mItemList[i].gameObject.SetActive(true);
                    itemScript.mItemList[i].SetItemData(itemData, itemIndex);
                }
                else
                {
                    itemScript.mItemList[i].gameObject.SetActive(false);
                }
            }
            return(item);
        }
Beispiel #22
0
        /*when a row is getting show in the scrollrect viewport,
         * this method will be called with the row’ index as a parameter,
         * to let you create the row  and update its content.
         *
         * SuperScrollView uses single items with subitems that make up the columns in the row.
         * so in fact, the GridView is ListView.
         * if one row is make up with 3 subitems, then the GridView looks like:
         *
         *   row0:  subitem0 subitem1 subitem2
         *   row1:  subitem3 subitem4 subitem5
         *   row2:  subitem6 subitem7 subitem8
         *   row3:  subitem9 subitem10 subitem11
         *   ...
         */

        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int rowIndex)
        {
            if (rowIndex < 0)
            {
                return(null);
            }
            //create one row
            LoopListViewItem2 item       = listView.NewListViewItem("RowPrefab");
            ListItem15        itemScript = item.GetComponent <ListItem15>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            //update all items in the row
            for (int i = 0; i < mItemCountPerRow; ++i)
            {
                int itemIndex = rowIndex * mItemCountPerRow + i;
                if (itemIndex >= mItemTotalCount)
                {
                    itemScript.mItemList[i].gameObject.SetActive(false);
                    continue;
                }
                //update the subitem content.
                itemScript.mItemList[i].gameObject.SetActive(true);
                itemScript.mItemList[i].mNameText.text = "Item" + itemIndex;
            }
            return(item);
        }
Beispiel #23
0
        private LoopListViewItem2 GetItemHandle(LoopListView2 listView, int index)
        {
            if (index < 0 || index >= data.Count)
            {
                return(null);
            }

            AffairInfo info = data[index];

            if (string.IsNullOrEmpty(info.uid))
            {
                return(null);
            }
            LoopListViewItem2 item  = listView.NewListViewItem("TimeParts");
            TimeParts         parts = item.GetComponent <TimeParts>();

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
            }
            //parts.Clear();
            parts.AddClickEvent(ClickItemHandler);
            parts.UpdateInfo(info, index);
            return(item);
        }
Beispiel #24
0
    LoopListViewItem2 InitScrollView(LoopListView2 listView, int index)
    {
        // Debug.Log("InitScrollView index = "+ index);
        if (index < 0 || index >= TotalItemCount)
        {
            return(null);
        }

        RoundData itemData = GetItemDataByIndex(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("RoundItem");
        //Debug.Log("item name = "+item.name);
        RoundItem itemScript = item.GetComponent <RoundItem>();

        if (item.IsInitHandlerCalled == false)
        {
            item.IsInitHandlerCalled = true;
            itemScript.Init();
        }
        itemScript.SetItemData(itemData, false, index);
        return(item);
    }
Beispiel #25
0
        public static LoopListViewItem2 GetItemByIndex(this UIReview self, LoopListView2 listView, int index)
        {
            if (index < 0 || index > self.ReviewItems?.Count)
            {
                return(null);
            }

            var data = self.ReviewItems[index];
            var item = listView.NewListViewItem("ReviewItem");

            if (!item.IsInitHandlerCalled)
            {
                item.IsInitHandlerCalled = true;
                self.ListView.AddItemViewComponent <UIReviewItem>(item);
            }
            var uiitemview = self.ListView.GetUIItemView <UIReviewItem>(item);

            I18NComponent.Instance.I18NTryGetText(data.Name, out data.Name);
            var    contents = data.Content.Split(',');
            string showtext = "";

            for (int i = 0; i < contents.Length; i++)
            {
                I18NComponent.Instance.I18NTryGetText(contents[i], out var temp);
                showtext += temp;
            }
            uiitemview.SetData(data.Name, showtext);
            return(item);
        }
Beispiel #26
0
    private LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
    {
        LoopListViewItem2 item = listView.NewListViewItem("ItemPrefab1");

        Item itemScript = item.GetComponent <Item>();

        itemScript.SetItemData(index);

        return(item);
    }
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            Debug.Log(index);
            if (index < 0)
            {
                return(null);
            }
            LoopListViewItem2 item = null;

            if (index == 0)
            {
                item = listView.NewListViewItem("ItemPrefab___0");
                UpdateLoadingTip(item);
                return(item);
            }
            //index == DataSourceMgr.Get.TotalItemCount &&
            if (DataSourceMgr.Get.GetItemDataByIndex(index) == null)
            {
                Debug.Log("  total   " + index);
                item = listView.NewListViewItem("ItemPrefab___0");
                UpdateLoadingTip(item);
                return(item);
            }

            int      itemIndex = index - 1;
            ItemData itemData  = DataSourceMgr.Get.GetItemDataByIndex(itemIndex);

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

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            itemScript.SetItemData(itemData, itemIndex);
            return(item);
        }
Beispiel #28
0
        //更新item数据
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0)
            {
                return(null);
            }
            LoopListViewItem2 item = null;

            //当index == 总的数据条数
            if (index == SuperDataSourceMgr.Get.TotalItemCount)
            {
                item = listView.NewListViewItem("ItemPrefab0");
                //更新加载栏状态
                UpdateLoadingTip(item);
                return(item);
            }
            LiveReviewItem itemData = SuperDataSourceMgr.Get.GetItemDataByIndex(index);

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

            //如果没有初始化,则进行初始化
            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            if (index == SuperDataSourceMgr.Get.TotalItemCount - 1)
            {
                item.Padding = 0;
            }
            //更新item数据和UI
            itemScript.SetItemData(itemData, index);
            return(item);
        }
Beispiel #29
0
        private LoopListViewItem2 OnUpdate(LoopListView2 _view, int _index)
        {
            if (_index < 0)
            {
                return((LoopListViewItem2)null);
            }
            LoopListViewItem2 loopListViewItem2 = _view.NewListViewItem(((Object)this.original).get_name());

            if (loopListViewItem2 is PageButton pageButton)
            {
                pageButton.SetData(_index, this.page == _index, (Action <int>)(_i => this.SetPage(_i, false)));
            }
            return(loopListViewItem2);
        }
        LoopListViewItem2 OnGetItemByIndex(LoopListView2 listView, int index)
        {
            if (index < 0)
            {
                return(null);
            }
            LoopListViewItem2 item = null;

            if (index == DataSourceMgr.Get.TotalItemCount)
            {
                item = listView.NewListViewItem("ItemPrefab0");
                if (item.IsInitHandlerCalled == false)
                {
                    item.IsInitHandlerCalled = true;
                    ListItem11 itemScript0 = item.GetComponent <ListItem11>();
                    itemScript0.mRootButton.onClick.AddListener(OnLoadMoreBtnClicked);
                }
                UpdateLoadingTip(item);
                return(item);
            }
            ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(index);

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

            if (item.IsInitHandlerCalled == false)
            {
                item.IsInitHandlerCalled = true;
                itemScript.Init();
            }
            itemScript.SetItemData(itemData, index);
            return(item);
        }