Beispiel #1
0
        private void OnValueChanged()
        {
            float _sd = (int)scrollRect.content.localPosition.y - (int)tempScrollPosY;

            if (_sd >= 0)
            {
                scrollDirectionType = EnScrollDirectionType.Down;
            }
            else if (_sd < 0)
            {
                scrollDirectionType = EnScrollDirectionType.Up;
            }
            tempScrollPosY        = scrollRect.content.localPosition.y;
            scrollViewUpdateCount = itemCount;
        }
Beispiel #2
0
        private void ScrollViewUpdate()
        {
            if (scrollDirectionType == EnScrollDirectionType.None)
            {
                return;
            }

            --scrollViewUpdateCount;
            if (scrollViewUpdateCount <= 0)
            {
                scrollDirectionType = EnScrollDirectionType.None;
                return;
            }

            Vector3 _lp;

            if (scrollDirectionType == EnScrollDirectionType.Up)
            {
                if (startIndex >= 0)
                {
                    for (int i = 0; i < itemCount; i++)
                    {
                        if (items[i].transform.position.y < -4)
                        {
                            _lp = items[i].transform.localPosition;
                            items[i].transform.localPosition = new Vector3(_lp.x, -itemSize.y * startIndex, _lp.z);

                            //
                            //items[i].GetComponent<MG_ItemGameRoomInfo>().GO_text.text = startIndex.ToString();
                            items[i].GetComponent <HiScrollViewItem>().ItemUpdate(startIndex);

                            if (startIndex < 0)
                            {
                                items[i].SetActive(false);
                            }
                            else
                            {
                                items[i].SetActive(true);
                            }
                            --startIndex;
                            --endIndex;
                            S_ContentsInfo.Instance.LobbyScrollSItemIndex = startIndex;
                            S_ContentsInfo.Instance.LobbyScrollEItemIndex = endIndex;
                        }
                    }
                }
            }
            else if (scrollDirectionType == EnScrollDirectionType.Down)
            {
                if (endIndex < itemTotalCount)
                {
                    for (int i = 0; i < itemCount; i++)
                    {
                        if (items[i].transform.position.y > 4)
                        {
                            _lp = items[i].transform.localPosition;
                            items[i].transform.localPosition = new Vector3(_lp.x, -itemSize.y * endIndex, _lp.z);

                            //
                            //items[i].GetComponent<MG_ItemGameRoomInfo>().GO_text.text = endIndex.ToString();
                            items[i].GetComponent <HiScrollViewItem>().ItemUpdate(endIndex);

                            if (endIndex >= itemTotalCount)
                            {
                                items[i].SetActive(false);
                            }
                            else
                            {
                                items[i].SetActive(true);
                            }
                            ++startIndex;
                            ++endIndex;
                            S_ContentsInfo.Instance.LobbyScrollSItemIndex = startIndex;
                            S_ContentsInfo.Instance.LobbyScrollEItemIndex = endIndex;
                        }
                    }
                }
            }
        }