예제 #1
0
 public virtual void ScrollViewDidZoom(CCScrollView view)
 {
 }
예제 #2
0
 /**
  * Returns an autoreleased scroll view object.
  *
  * @param size view size
  * @param container parent object
  * @return autoreleased scroll view object
  */
 public static new CCScrollView Create()
 {
     var pRet = new CCScrollView();
     pRet.Init();
     return pRet;
 }
예제 #3
0
        public virtual void ScrollViewDidScroll(CCScrollView view)
        {
            var uCountOfItems = m_pDataSource.NumberOfCellsInTableView(this);
            if (uCountOfItems == 0)
            {
                return;
            }

            int startIdx = 0, endIdx = 0, idx = 0, maxIdx = 0;

            CCPoint offset = CCPointExtension.Multiply(GetContentOffset(), -1);
            maxIdx = Math.Max(uCountOfItems - 1, 0);

            CCSize cellSize = m_pDataSource.CellSizeForTable(this);

            if (m_eVordering == CCTableViewVerticalFillOrder.FillTopDown)
            {
                offset.Y = offset.Y + m_tViewSize.Height / Container.ScaleY - cellSize.Height;
            }
            startIdx = _indexFromOffset(offset);

            if (m_eVordering == CCTableViewVerticalFillOrder.FillTopDown)
            {
                offset.Y -= m_tViewSize.Height / Container.ScaleY;
            }
            else
            {
                offset.Y += m_tViewSize.Height / Container.ScaleY;
            }
            offset.X += m_tViewSize.Width / Container.ScaleX;

            endIdx = _indexFromOffset(offset);

            #if DEBUG_ // For Testing.
            int i = 0;
            foreach (object pObj in m_pCellsUsed)
            {
                var pCell = (CCTableViewCell)pObj;
                CCLog.Log("cells Used index {0}, value = {1}", i, pCell.getIdx());
                i++;
            }
            CCLog.Log("---------------------------------------");
            i = 0;
            foreach(object pObj in m_pCellsFreed)
            {
                var pCell = (CCTableViewCell)pObj;
                CCLog.Log("cells freed index {0}, value = {1}", i, pCell.getIdx());
                i++;
            }
            CCLog.Log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            #endif

            if (m_pCellsUsed.Count > 0)
            {
                var cell = (CCTableViewCell) m_pCellsUsed[0];

                idx = cell.Index;
                while (idx < startIdx)
                {
                    _moveCellOutOfSight(cell);
                    if (m_pCellsUsed.Count > 0)
                    {
                        cell = (CCTableViewCell) m_pCellsUsed[0];
                        idx = cell.Index;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            if (m_pCellsUsed.Count > 0)
            {
                var cell = (CCTableViewCell) m_pCellsUsed[m_pCellsUsed.Count - 1];
                idx = cell.Index;

                while (idx <= maxIdx && idx > endIdx)
                {
                    _moveCellOutOfSight(cell);
                    if (m_pCellsUsed.Count > 0)
                    {
                        cell = (CCTableViewCell) m_pCellsUsed[m_pCellsUsed.Count - 1];
                        idx = cell.Index;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            for (int j = startIdx; j <= endIdx; j++)
            {
                if (m_pIndices.Contains(j))
                {
                    continue;
                }
                UpdateCellAtIndex(j);
            }
        }
예제 #4
0
 /**
  * Returns an autoreleased scroll view object.
  *
  * @param size view size
  * @param container parent object
  * @return autoreleased scroll view object
  */
 public static CCScrollView Create(CCSize size, CCNode container)
 {
     var pRet = new CCScrollView();
     pRet.InitWithViewSize(size, container);
     return pRet;
 }