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);
        }
Example #2
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);
        }
        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);
        }
Example #4
0
        //得到Item
        public LoopListViewItem2 GetItem()
        {
            mCurItemIdCount++;
            LoopListViewItem2 tItem = null;

            if (mTmpPooledItemList.Count > 0)
            {//如果mTmpPooledItemList表中有数据从mTmpPooledItemList表中取出最后一个数据并且显示,并在表中删除此数据
                int count = mTmpPooledItemList.Count;
                tItem = mTmpPooledItemList[count - 1];
                mTmpPooledItemList.RemoveAt(count - 1);
                tItem.gameObject.SetActive(true);
            }
            else
            {//mTmpPooledItemList表中没有数据,则从mPooledItemList表中去除数据,如果mPooledItemList表中没有数据曾创建一个
                int count = mPooledItemList.Count;
                if (count == 0)
                {
                    tItem = CreateItem();
                }
                else
                {
                    tItem = mPooledItemList[count - 1];
                    mPooledItemList.RemoveAt(count - 1);
                    tItem.gameObject.SetActive(true);
                }
            }
            tItem.Padding = mPadding;
            tItem.ItemId  = mCurItemIdCount;
            return(tItem);
        }
        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);
        }
Example #6
0
        private void OnDraging1()
        {
            if (this.mLoopListView.ShownItemCount == 0 || this.mLoadingTipStatus1 != LoadingTipStatus.None && this.mLoadingTipStatus1 != LoadingTipStatus.WaitRelease)
            {
                return;
            }
            LoopListViewItem2 shownItemByItemIndex = this.mLoopListView.GetShownItemByItemIndex(0);

            if (Object.op_Equality((Object)shownItemByItemIndex, (Object)null))
            {
                return;
            }
            if (this.mLoopListView.ScrollRect.get_content().get_anchoredPosition3D().y < -(double)this.mLoadingTipItemHeight1)
            {
                if (this.mLoadingTipStatus1 != LoadingTipStatus.None)
                {
                    return;
                }
                this.mLoadingTipStatus1 = LoadingTipStatus.WaitRelease;
                this.UpdateLoadingTip1(shownItemByItemIndex);
                shownItemByItemIndex.CachedRectTransform.set_anchoredPosition3D(new Vector3(0.0f, this.mLoadingTipItemHeight1, 0.0f));
            }
            else
            {
                if (this.mLoadingTipStatus1 != LoadingTipStatus.WaitRelease)
                {
                    return;
                }
                this.mLoadingTipStatus1 = LoadingTipStatus.None;
                this.UpdateLoadingTip1(shownItemByItemIndex);
                shownItemByItemIndex.CachedRectTransform.set_anchoredPosition3D(new Vector3(0.0f, 0.0f, 0.0f));
            }
        }
        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);
        }
Example #8
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);
        }
        void Update()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }

            if (mLoadingTipStatus == LoadingTipStatus.Loaded)
            {
                mDataLoadedTipShowLeftTime -= Time.deltaTime;
                if (mDataLoadedTipShowLeftTime <= 0)
                {
                    mLoadingTipStatus = LoadingTipStatus.None;
                    LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(0);
                    if (item == null)
                    {
                        return;
                    }

                    UpdateLoadingTip(item);
                    item.CachedRectTransform.localPosition = new Vector3(0, -mLoadingTipItemHeight, 0);
                    mLoopListView.OnItemSizeChanged(0);

                    Debug.Log("OnItemSizeChanged 0");
                    mLoopListView.SetListItemCount(DataSourceMgr.Get.TotalItemCount + 1, true);
                }
            }
        }
        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 void UpdateLoadingTip(LoopListViewItem2 item)
        {
            if (Object.op_Equality((Object)item, (Object)null))
            {
                return;
            }
            ListItem11 component = (ListItem11)((Component)item).GetComponent <ListItem11>();

            if (Object.op_Equality((Object)component, (Object)null))
            {
                return;
            }
            if (this.mLoadingTipStatus == LoadingTipStatus.None)
            {
                component.mText.set_text("Click to Load More");
                component.mWaitingIcon.SetActive(false);
            }
            else
            {
                if (this.mLoadingTipStatus != LoadingTipStatus.WaitLoad)
                {
                    return;
                }
                component.mWaitingIcon.SetActive(true);
                component.mText.set_text("Loading ...");
            }
        }
Example #12
0
        void OnEndDrag()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None && mLoadingTipStatus != LoadingTipStatus.WaitRelease)
            {
                return;
            }
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount);

            if (item == null)
            {
                return;
            }
            mLoopListView.OnItemSizeChanged(item.ItemIndex);
            if (mLoadingTipStatus != LoadingTipStatus.WaitRelease)
            {
                return;
            }
            mLoadingTipStatus = LoadingTipStatus.WaitLoad;
            UpdateLoadingTip(item);
            //请求加载更多数据
            DataSourceMgr.Get.RequestLoadMoreDataList(mLoadMoreCount, OnDataSourceLoadMoreFinished);
        }
        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);
        }
Example #14
0
        /// <summary>
        /// 更新加载栏状态
        /// </summary>
        /// <param name="item"></param>
        void UpdateLoadingTip(LoopListViewItem2 item)
        {
            if (item == null)
            {
                return;
            }
            ListItem0 itemScript0 = item.GetComponent <ListItem0>();

            if (itemScript0 == null)
            {
                return;
            }
            if (mLoadingTipStatus == LoadingTipStatus.None)
            {
                itemScript0.mRoot.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);
            }
            else if (mLoadingTipStatus == LoadingTipStatus.WaitRelease)
            {
                itemScript0.mRoot.SetActive(true);
                itemScript0.mText.text = "Release to Load More";
                itemScript0.mArrow.SetActive(true);
                itemScript0.mWaitingIcon.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, mLoadingTipItemHeight);
            }
            else if (mLoadingTipStatus == LoadingTipStatus.WaitLoad)
            {
                itemScript0.mRoot.SetActive(true);
                itemScript0.mArrow.SetActive(false);
                itemScript0.mWaitingIcon.SetActive(true);
                itemScript0.mText.text = "Loading ...";
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, mLoadingTipItemHeight);
            }
        }
        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);
        }
Example #16
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);
        }
Example #17
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);
        }
        void OnEndDrag()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None && mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
            {
                return;
            }

            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(0);

            if (item == null)
            {
                return;
            }
            mLoopListView.OnItemSizeChanged(item.ItemIndex);
            if (mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
            {
                return;
            }
            mLoadingTipStatus = LoadingTipStatus.WaitLoad;
            UpdateLoadingTip(item);
            DataSourceMgr.Get.RequestRefreshDataList(OnDataSourceRefreshFinished);
        }
        void OnEndDrag2()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus2 != LoadingTipStatus.None && mLoadingTipStatus2 != LoadingTipStatus.WaitRelease)
            {
                return;
            }
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(GetMaxRowCount() + 1);

            if (item == null)
            {
                return;
            }
            mLoopListView.OnItemSizeChanged(item.ItemIndex);
            if (mLoadingTipStatus2 != LoadingTipStatus.WaitRelease)
            {
                return;
            }
            mLoadingTipStatus2 = LoadingTipStatus.WaitLoad;
            UpdateLoadingTip2(item);
            DataSourceMgr.Get.RequestLoadMoreDataList(mLoadMoreCount, OnDataSourceLoadMoreFinished);
        }
Example #20
0
    static int GetItemCornerPosInViewPort(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                SuperScrollView.LoopListView2     obj  = (SuperScrollView.LoopListView2)ToLua.CheckObject <SuperScrollView.LoopListView2>(L, 1);
                SuperScrollView.LoopListViewItem2 arg0 = (SuperScrollView.LoopListViewItem2)ToLua.CheckObject <SuperScrollView.LoopListViewItem2>(L, 2);
                UnityEngine.Vector3 o = obj.GetItemCornerPosInViewPort(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                SuperScrollView.LoopListView2     obj  = (SuperScrollView.LoopListView2)ToLua.CheckObject <SuperScrollView.LoopListView2>(L, 1);
                SuperScrollView.LoopListViewItem2 arg0 = (SuperScrollView.LoopListViewItem2)ToLua.CheckObject <SuperScrollView.LoopListViewItem2>(L, 2);
                SuperScrollView.ItemCornerEnum    arg1 = (SuperScrollView.ItemCornerEnum)ToLua.CheckObject(L, 3, TypeTraits <SuperScrollView.ItemCornerEnum> .type);
                UnityEngine.Vector3 o = obj.GetItemCornerPosInViewPort(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: SuperScrollView.LoopListView2.GetItemCornerPosInViewPort"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #21
0
        public LoopListViewItem2 GetItem()
        {
            mCurItemIdCount++;
            LoopListViewItem2 tItem = null;

            if (mTmpPooledItemList.Count > 0)
            {
                int count = mTmpPooledItemList.Count;
                tItem = mTmpPooledItemList[count - 1];
                mTmpPooledItemList.RemoveAt(count - 1);
                tItem.gameObject.SetActive(true);
            }
            else
            {
                int count = mPooledItemList.Count;
                if (count == 0)
                {
                    tItem = CreateItem();
                }
                else
                {
                    tItem = mPooledItemList[count - 1];
                    mPooledItemList.RemoveAt(count - 1);
                    tItem.gameObject.SetActive(true);
                }
            }
            tItem.Padding = mPadding;
            tItem.ItemId  = mCurItemIdCount;
            return(tItem);
        }
        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);
        }
Example #23
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);
        }
Example #24
0
        void OnMonthSnapTargetFinished(LoopListView2 listView, LoopListViewItem2 item)
        {
            LoopListViewItem2 item0      = mLoopListViewDay.GetShownItemByIndex(0);
            ListItem7         itemScript = item0.GetComponent <ListItem7>();
            int index = itemScript.Value - 1;

            mLoopListViewDay.RefreshAllShownItemWithFirstIndex(index);
        }
Example #25
0
        private void UpdateLoadingTip1(LoopListViewItem2 item)
        {
            if (Object.op_Equality((Object)item, (Object)null))
            {
                return;
            }
            item.CachedRectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis) 0, this.mLoopListView.ViewPortWidth);
            ListItem17 component = (ListItem17)((Component)item).GetComponent <ListItem17>();

            if (Object.op_Equality((Object)component, (Object)null))
            {
                return;
            }
            if (this.mLoadingTipStatus1 == LoadingTipStatus.None)
            {
                component.mRoot1.SetActive(false);
                component.mRoot.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis) 1, 0.0f);
            }
            else if (this.mLoadingTipStatus1 == LoadingTipStatus.WaitContinureDrag)
            {
                component.mRoot1.SetActive(true);
                component.mRoot.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis) 1, 0.0f);
            }
            else if (this.mLoadingTipStatus1 == LoadingTipStatus.WaitRelease)
            {
                component.mRoot1.SetActive(false);
                component.mRoot.SetActive(true);
                component.mText.set_text("Release to Refresh");
                component.mArrow.SetActive(true);
                component.mWaitingIcon.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis) 1, this.mLoadingTipItemHeight1);
            }
            else if (this.mLoadingTipStatus1 == LoadingTipStatus.WaitLoad)
            {
                component.mRoot1.SetActive(false);
                component.mRoot.SetActive(true);
                component.mArrow.SetActive(false);
                component.mWaitingIcon.SetActive(true);
                component.mText.set_text("Loading ...");
                item.CachedRectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis) 1, this.mLoadingTipItemHeight1);
            }
            else
            {
                if (this.mLoadingTipStatus1 != LoadingTipStatus.Loaded)
                {
                    return;
                }
                component.mRoot1.SetActive(false);
                component.mRoot.SetActive(true);
                component.mArrow.SetActive(false);
                component.mWaitingIcon.SetActive(false);
                component.mText.set_text("Refreshed Success");
                item.CachedRectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis) 1, this.mLoadingTipItemHeight1);
            }
        }
Example #26
0
 void OnListViewSnapTargetChanged(LoopListView2 listView, int targetIndex)
 {
     for (int i = 0; i < listView.ShownItemCount; ++i)
     {
         LoopListViewItem2 item2      = listView.GetShownItemByIndex(i);
         ListItem7         itemScript = item2.GetComponent <ListItem7>();
         itemScript.OnListViewSnapTargetChanged(i == targetIndex);
     }
 }
Example #27
0
        private void OnHourSnapTargetChanged(LoopListView2 listView, LoopListViewItem2 item)
        {
            int indexInShownItemList = listView.GetIndexInShownItemList(item);

            if (indexInShownItemList < 0)
            {
                return;
            }
            this.mCurSelectedHour = ((ListItem7)((Component)item).GetComponent <ListItem7>()).Value;
            this.OnListViewSnapTargetChanged(listView, indexInShownItemList);
        }
        void OnEndDrag()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None &&
                mLoadingTipStatus != LoadingTipStatus.WaitReleasePush &&
                mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
            {
                return;
            }

            // 上拉加载
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount);

            if (item != null)
            {
                mLoopListView.OnItemSizeChanged(item.ItemIndex);
                if (mLoadingTipStatus != LoadingTipStatus.WaitReleasePush)
                {
                    //Debug.Log("上拉 ==>> RETURN");
                    //return;
                }
                else
                {
                    //Debug.Log("上拉加载");
                    mLoadingTipStatus = LoadingTipStatus.WaitLoad;
                    UpdateLoadingTip(item);
                    DataSourceMgr.Get.RequestLoadMoreDataList(mLoadMoreCount, OnDataSourceLoadMoreFinished);
                }
            }

            // 下拉刷新
            LoopListViewItem2 _item = mLoopListView.GetShownItemByItemIndex(0);

            if (_item != null)
            {
                mLoopListView.OnItemSizeChanged(_item.ItemIndex);
                if (mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
                {
                    //Debug.Log("下拉 ==>> RETURN");
                    //return;
                }
                else
                {
                    //Debug.Log("下拉刷新");
                    mLoadingTipStatus = LoadingTipStatus.WaitLoad;
                    UpdateLoadingTip(_item);
                    DataSourceMgr.Get.RequestRefreshDataList(OnDataSourceRefreshFinished);
                }
            }
        }
        void UpdateLoadingTip1(LoopListViewItem2 item)
        {
            if (item == null)
            {
                return;
            }
            item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, mLoopListView.ViewPortWidth);
            ListItem17 itemScript0 = item.GetComponent <ListItem17>();

            if (itemScript0 == null)
            {
                return;
            }
            if (mLoadingTipStatus1 == LoadingTipStatus.None)
            {
                itemScript0.mRoot1.SetActive(false);
                itemScript0.mRoot.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);
            }
            else if (mLoadingTipStatus1 == LoadingTipStatus.WaitContinureDrag)
            {
                itemScript0.mRoot1.SetActive(true);
                itemScript0.mRoot.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);
            }
            else if (mLoadingTipStatus1 == LoadingTipStatus.WaitRelease)
            {
                itemScript0.mRoot1.SetActive(false);
                itemScript0.mRoot.SetActive(true);
                itemScript0.mText.text = "Release to Refresh";
                itemScript0.mArrow.SetActive(true);
                itemScript0.mWaitingIcon.SetActive(false);
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, mLoadingTipItemHeight1);
            }
            else if (mLoadingTipStatus1 == LoadingTipStatus.WaitLoad)
            {
                itemScript0.mRoot1.SetActive(false);
                itemScript0.mRoot.SetActive(true);
                itemScript0.mArrow.SetActive(false);
                itemScript0.mWaitingIcon.SetActive(true);
                itemScript0.mText.text = "Loading ...";
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, mLoadingTipItemHeight1);
            }
            else if (mLoadingTipStatus1 == LoadingTipStatus.Loaded)
            {
                itemScript0.mRoot1.SetActive(false);
                itemScript0.mRoot.SetActive(true);
                itemScript0.mArrow.SetActive(false);
                itemScript0.mWaitingIcon.SetActive(false);
                itemScript0.mText.text = "Refreshed Success";
                item.CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, mLoadingTipItemHeight1);
            }
        }
        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);
            }
        }