예제 #1
0
        /// <summary>
        /// 设置开始render和结束render位置
        /// </summary>
        protected override IntVector2 getRenderListRange()
        {
            IntVector2 result = base.getRenderListRange();

            if (_scrollTransform == null)
            {
                return(result);
            }

            int   totalCount = _dataProvider.Count;
            float posY       = _layoutTransform.anchoredPosition.y; //相对pagelist的y

            for (int i = 0; i < totalCount; i++)
            {
                IVerticalVO vo         = (IVerticalVO)_dataProvider[i];
                float       iconHeight = vo.height;
                posY -= iconHeight;
                if (posY - iconHeight > 0)
                {
                    result.x = i;
                }

                float scrollRectHeight = -_scrollTransform.rect.height;
                if (posY + iconHeight < scrollRectHeight)
                {
                    result.y = i;
                    break;
                }
            }

            return(result);
        }
예제 #2
0
        protected virtual float getTotalLength()
        {
            float result = 0;

            for (int i = 0, len = _dataProvider.Count; i < len; i++)
            {
                IVerticalVO vo = (IVerticalVO)_dataProvider[i];
                result += vo.height;
            }

            return(result);
        }
예제 #3
0
        protected virtual float getPositionY(int index, float offset)
        {
            float result = offset;

            for (int i = 0, len = _dataProvider.Count; i < len; i++)
            {
                if (i >= index)
                {
                    break;
                }
                IVerticalVO vo = (IVerticalVO)_dataProvider[i];
                result -= vo.height;
            }
            return(result);
        }