Exemple #1
0
 private void shiftUp(float d)
 {
     for (int i = firstPos; i <= lastPos; i++)
     {
         ItemBundle beforeB = getByPosition(i - 1);
         ItemBundle ib      = getByPosition(i);
         if (beforeB == null)
         {
             Vector2 v = ib.trans.anchoredPosition + new Vector2(0, d);
             if ((lastPos + 1) < adapter.getCount() && v.y > getTopLimtY())
             {
                 firstPos++;
                 ib.position = ++lastPos;
             }
             else
             {
                 ib.trans.anchoredPosition += new Vector2(0, d);
             }
         }
         else
         {
             ib.trans.anchoredPosition = beforeB.getBottomCenter();
         }
     }
 }
Exemple #2
0
        public bool isEnded()
        {
            ItemBundle ib = getByPosition(adapter.getCount() - 1);

            if (ib == null)
            {
                return(false);
            }
            return(ib.getBottomCenter().y > getBottomLimtY());
        }
Exemple #3
0
        private bool lockMoveToTop(float d)
        {
            ItemBundle lastB = getByPosition(lastPos);

            if (lastB == null)
            {
                return(false);
            }
            float y       = lastB.getBottomCenter().y;
            bool  db      = d > 0;
            bool  indexB  = lastPos >= adapter.getCount();
            bool  heightB = y > -getContainerHeight();

            return(d > 0 && (lastPos + 1) >= adapter.getCount() && y > -getContainerHeight());
        }
Exemple #4
0
 private void shiftDown(float d)
 {
     for (int i = lastPos; i >= firstPos; i--)
     {
         ItemBundle nextB = getByPosition(i + 1);
         ItemBundle ib    = getByPosition(i);
         if (nextB == null)
         {
             if ((firstPos) > 0 && ib.getBottomCenter().y < getBottomLimtY())
             {
                 lastPos--;
                 ib.position = --firstPos;
             }
             else
             {
                 ib.trans.anchoredPosition += new Vector2(0, d);
             }
         }
         else
         {
             ib.trans.anchoredPosition = nextB.trans.anchoredPosition + new Vector2(0, ib.trans.rect.height);
         }
     }
 }