コード例 #1
0
        protected void ReleaseOneElementToTmp(ListViewElement ele)
        {
            if (ele == null)
            {
                return;
            }

            var prefabName = ele.ItemPrefabName;

            if (string.IsNullOrEmpty(prefabName))
            {
                return;
            }

            ListViewElementPool pool;

            if (_elementPoolDict.TryGetValue(prefabName, out pool))
            {
                pool.ReleaseOneElementToTmp(ele);
            }
        }
コード例 #2
0
 void ReleaseOneElementToCache(ListViewElement ele)
 {
     ele.gameObject.SetActive(false);
     _elementCache.Push(ele);
 }
コード例 #3
0
        public void MovePanelToElementIndex(int elementIndex, float offset)
        {
            _scrollRect.StopMovement();

            if (elementIndex < 0 || _totalElementCount == 0)
            {
                return;
            }
            if (elementIndex >= _totalElementCount)
            {
                elementIndex = _totalElementCount - 1;
            }

            if (offset < 0)
            {
                offset = 0;
            }

            var   firstElePos  = Vector2.zero;
            float viewportSize = ViewportSize;

            if (offset > viewportSize)
            {
                offset = viewportSize;
            }

            if (_arrangeType == ListElementArrangeType.TopToBottom)
            {
                var contentPos = _contentTrans.localPosition.y;
                if (contentPos < 0)
                {
                    contentPos = 0;
                }

                firstElePos.y = -contentPos - offset;
            }
            else if (_arrangeType == ListElementArrangeType.BottomToTop)
            {
            }
            else if (_arrangeType == ListElementArrangeType.LeftToRight)
            {
                var contentPos = _contentTrans.localPosition.x;
                if (contentPos > 0)
                {
                    contentPos = 0;
                }

                firstElePos.x = -contentPos + offset;
            }
            else if (_arrangeType == ListElementArrangeType.RightToLeft)
            {
            }

            ReleaseAllElementToPool();
            ListViewElement newEle = GetNewElementByIndex(elementIndex);

            if (newEle == null)
            {
                ClearTmpCache();
                return;
            }

            if (_isVertical)
            {
                firstElePos.x = newEle.StartPosOffset;
            }
            else
            {
                firstElePos.y = newEle.StartPosOffset;
            }
            newEle.SetPosition(firstElePos);

            _activeElementList.Add(newEle);
            UpdateContentSize();
            UpdateListView(viewportSize + 100, viewportSize + 100, viewportSize, viewportSize);
            CheckAndFitContentPos();

            ClearTmpCache();
        }
コード例 #4
0
 public void ReleaseOneElementToTmp(ListViewElement ele)
 {
     _tmpElementCache.Push(ele);
 }