void OnDraging()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None && mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
            {
                return;
            }

            // 重新加载
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(0);

            if (item == null)
            {
                return;
            }

            ScrollRect sr  = mLoopListView.ScrollRect;
            Vector3    pos = sr.content.localPosition;

            if (pos.y < -mLoadingTipItemHeight)
            {
                if (mLoadingTipStatus != LoadingTipStatus.None)
                {
                    return;
                }
                Debug.Log("<<<<"); //刷新
                mLoadingTipStatus = LoadingTipStatus.WaitReleasePull;
                UpdateLoadingTip(item);
                item.CachedRectTransform.localPosition = new Vector3(0, mLoadingTipItemHeight, 0);
            }
            else
            {
                if (mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
                {
                    return;
                }
                Debug.Log(">>>>"); //放弃
                mLoadingTipStatus = LoadingTipStatus.None;
                UpdateLoadingTip(item);
                item.CachedRectTransform.localPosition = new Vector3(0, 0, 0);
            }
        }
Esempio n. 2
0
        void OnDraging()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None && mLoadingTipStatus != LoadingTipStatus.WaitRelease)
            {
                return;
            }
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount);

            if (item == null)
            {
                return;
            }
            LoopListViewItem2 item1 = mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount - 1);

            if (item1 == null)
            {
                return;
            }
            float y = mLoopListView.GetItemCornerPosInViewPort(item1, ItemCornerEnum.LeftBottom).y;

            if (y + mLoopListView.ViewPortSize >= mLoadingTipItemHeight)
            {
                if (mLoadingTipStatus != LoadingTipStatus.None)
                {
                    return;
                }
                mLoadingTipStatus = LoadingTipStatus.WaitRelease;
                UpdateLoadingTip(item);
            }
            else
            {
                if (mLoadingTipStatus != LoadingTipStatus.WaitRelease)
                {
                    return;
                }
                mLoadingTipStatus = LoadingTipStatus.None;
                UpdateLoadingTip(item);
            }
        }
Esempio n. 3
0
        void OnDraging()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None && mLoadingTipStatus != LoadingTipStatus.WaitRelease)
            {
                return;
            }
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(0);

            if (item == null)
            {
                return;
            }
            ScrollRect sr  = mLoopListView.ScrollRect;
            Vector3    pos = sr.content.anchoredPosition3D;

            if (pos.y < -mLoadingTipItemHeight)
            {
                if (mLoadingTipStatus != LoadingTipStatus.None)
                {
                    return;
                }
                mLoadingTipStatus = LoadingTipStatus.WaitRelease;
                UpdateLoadingTip(item);
                item.CachedRectTransform.anchoredPosition3D = new Vector3(0, mLoadingTipItemHeight, 0);
            }
            else
            {
                if (mLoadingTipStatus != LoadingTipStatus.WaitRelease)
                {
                    return;
                }
                mLoadingTipStatus = LoadingTipStatus.None;
                UpdateLoadingTip(item);
                item.CachedRectTransform.anchoredPosition3D = new Vector3(0, 0, 0);
            }
        }
Esempio n. 4
0
        void OnEndDrag()
        {
            float             vec = mLoopListView.ScrollRect.velocity.x;
            int               curNearestItemIndex = mLoopListView.CurSnapNearestItemIndex;
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(curNearestItemIndex);

            if (item == null)
            {
                mLoopListView.ClearSnapData();
                return;
            }
            if (Mathf.Abs(vec) < 50f)
            {
                mLoopListView.SetSnapTargetItemIndex(curNearestItemIndex);
                return;
            }
            Vector3 pos = mLoopListView.GetItemCornerPosInViewPort(item, ItemCornerEnum.LeftTop);

            if (pos.x > 0)
            {
                if (vec > 0)
                {
                    mLoopListView.SetSnapTargetItemIndex(curNearestItemIndex - 1);
                }
                else
                {
                    mLoopListView.SetSnapTargetItemIndex(curNearestItemIndex);
                }
            }
            else if (pos.x < 0)
            {
                if (vec > 0)
                {
                    mLoopListView.SetSnapTargetItemIndex(curNearestItemIndex);
                }
                else
                {
                    mLoopListView.SetSnapTargetItemIndex(curNearestItemIndex + 1);
                }
            }
            else
            {
                if (vec > 0)
                {
                    mLoopListView.SetSnapTargetItemIndex(curNearestItemIndex - 1);
                }
                else
                {
                    mLoopListView.SetSnapTargetItemIndex(curNearestItemIndex + 1);
                }
            }
        }
Esempio n. 5
0
    void OnEndDrag()
    {
        if (mLoopListView.ShownItemCount == 0)
        {
            return;
        }

        LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(0);

        if (item == null)
        {
            return;
        }
        mLoopListView.OnItemSizeChanged(item.ItemIndex);
    }
Esempio n. 6
0
    //public void RemoveFavorite(){
    //	GameManager.Instance.favObj.SetActive(false);
    //	GameManager.Instance.favorite[GameManager.Instance.favMIndex].rData.RemoveAt(GameManager.Instance.favRIndex);
    //	if(GameManager.Instance.favorite[GameManager.Instance.favMIndex].rData.Count==0){
    //		GameManager.Instance.favorite.RemoveAt(GameManager.Instance.favMIndex);
    //	}
    //	GameManager.Instance.dummyFavorite.RemoveAt(GameManager.Instance.favTempIndex);
    //	SaveGame.Save ( "Favorites", GameManager.Instance.favorite);
    //}

    void OnEndDrag()
    {
        if (mLoopListView.ShownItemCount == 0)
        {
            return;
        }

        LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(0);

        if (item == null)
        {
            return;
        }
        mLoopListView.OnItemSizeChanged(item.ItemIndex);
        transform.parent.GetChild(3).gameObject.SetActive(false);
    }
        void OnDraging1()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus1 != LoadingTipStatus.None && mLoadingTipStatus1 != LoadingTipStatus.WaitRelease &&
                mLoadingTipStatus1 != LoadingTipStatus.WaitContinureDrag)
            {
                return;
            }
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(0);

            if (item == null)
            {
                return;
            }
            ScrollRect sr  = mLoopListView.ScrollRect;
            Vector3    pos = sr.content.anchoredPosition3D;

            if (pos.y >= 0)
            {
                if (mLoadingTipStatus1 == LoadingTipStatus.WaitContinureDrag)
                {
                    mLoadingTipStatus1 = LoadingTipStatus.None;
                    UpdateLoadingTip1(item);
                    item.CachedRectTransform.anchoredPosition3D = new Vector3(0, 0, 0);
                }
            }
            else if (pos.y < 0 && pos.y > -mLoadingTipItemHeight1)
            {
                if (mLoadingTipStatus1 == LoadingTipStatus.None || mLoadingTipStatus1 == LoadingTipStatus.WaitRelease)
                {
                    mLoadingTipStatus1 = LoadingTipStatus.WaitContinureDrag;
                    UpdateLoadingTip1(item);
                    item.CachedRectTransform.anchoredPosition3D = new Vector3(0, 0, 0);
                }
            }
            else if (pos.y <= -mLoadingTipItemHeight1)
            {
                if (mLoadingTipStatus1 == LoadingTipStatus.WaitContinureDrag)
                {
                    mLoadingTipStatus1 = LoadingTipStatus.WaitRelease;
                    UpdateLoadingTip1(item);
                    item.CachedRectTransform.anchoredPosition3D = new Vector3(0, mLoadingTipItemHeight1, 0);
                }
            }
        }
Esempio n. 8
0
        void OnLoadMoreBtnClicked()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None)
            {
                return;
            }
            LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount);

            if (item == null)
            {
                return;
            }
            mLoadingTipStatus = LoadingTipStatus.WaitLoad;
            UpdateLoadingTip(item);
            DataSourceMgr.Get.RequestLoadMoreDataList(mLoadMoreCount, OnDataSourceLoadMoreFinished);
        }
        void OnDraging()
        {
            if (mLoopListView.ShownItemCount == 0)
            {
                return;
            }
            if (mLoadingTipStatus != LoadingTipStatus.None &&
                mLoadingTipStatus != LoadingTipStatus.WaitReleasePush &&
                mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
            {
                return;
            }

            ScrollRect sr  = mLoopListView.ScrollRect;
            Vector3    pos = sr.content.localPosition;

            if (pos.y > 0)
            {
                // 加载更多
                LoopListViewItem2 item = mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount); //最后一个prefab是否已经显示,可以开始加载更多
                //Debug.Log(DataSourceMgr.Get.TotalItemCount + " -->> " + (mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount) != null));
                if (item != null)
                {
                    LoopListViewItem2 item1 = mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount - 1);
                    if (item1 == null)
                    {
                        //Debug.Log("item1 == null");
                        return;
                    }

                    float y = mLoopListView.GetItemCornerPosInViewPort(item1, ItemCornerEnum.LeftBottom).y;
                    if (y + mLoopListView.ViewPortSize >= mLoadingTipItemHeight)
                    {
                        if (mLoadingTipStatus != LoadingTipStatus.None)
                        {
                            return;
                        }
                        mLoadingTipStatus = LoadingTipStatus.WaitReleasePush;
                        UpdateLoadingTip(item);
                    }
                    else
                    {
                        if (mLoadingTipStatus != LoadingTipStatus.WaitReleasePush)
                        {
                            //Debug.Log("Draging ==>> RETURN");
                            //return;
                        }
                        else
                        {
                            mLoadingTipStatus = LoadingTipStatus.None;
                            UpdateLoadingTip(item);
                        }
                    }
                }
                else
                {
                    Debug.Log(DataSourceMgr.Get.TotalItemCount + " ==>> " + (mLoopListView.GetShownItemByItemIndex(DataSourceMgr.Get.TotalItemCount) != null));
                }
            }
            else
            {
                //下拉刷新
                LoopListViewItem2 _item = mLoopListView.GetShownItemByItemIndex(0);
                if (_item != null)
                {
                    //ScrollRect sr = mLoopListView.ScrollRect;
                    //Vector3 pos = sr.content.localPosition;
                    if (pos.y < -mLoadingTipItemHeight)
                    {
                        if (mLoadingTipStatus != LoadingTipStatus.None)
                        {
                            return;
                        }
                        //Debug.Log("<<<<"); //刷新
                        mLoadingTipStatus = LoadingTipStatus.WaitReleasePull;
                        UpdateLoadingTip(_item);
                        _item.CachedRectTransform.localPosition = new Vector3(0, mLoadingTipItemHeight, 0);
                    }
                    else
                    {
                        if (mLoadingTipStatus != LoadingTipStatus.WaitReleasePull)
                        {
                            return;
                        }
                        //Debug.Log(">>>>"); //放弃
                        mLoadingTipStatus = LoadingTipStatus.None;
                        UpdateLoadingTip(_item);
                        _item.CachedRectTransform.localPosition = new Vector3(0, 0, 0);
                    }
                }
            }
        }