Exemplo n.º 1
0
        public BeeImage GetNextImage(bool loop)
        {
            // Empty List? Set everything to null.
            if (m_images.Count == 0)
            {
                m_nextImage = null;
                BeeImage.SetNextImage(null);
                return(null);
            }

            // If we're at the end, reset the list but return null
            // if we're not in a loop.
            if (m_atEnd)
            {
                ResetNextImage();
                if (!loop)
                {
                    return(null);
                }
            }

            // If we don't have an empty list, but also no next image
            // let's reset the next image.
            if (m_nextImage == null)
            {
                ResetNextImage();
            }

            int iNext = m_images.IndexOf(m_nextImage);

            // Weird case where m_nextImage isn't in the list anymore.
            if (iNext == -1)
            {
                ResetNextImage();
                iNext = 0;
            }

            BeeImage biRet    = m_nextImage;
            int      iNewNext = iNext + 1;

            if (iNewNext >= m_images.Count)
            {
                // If we're at the end of the list,
                // we set the next image to null,
                // unless we're looping, in which case
                // we Reset it (to 0, presumably).
                if (loop)
                {
                    ResetNextImage();
                }
                else
                {
                    m_nextImage = null;
                    m_atEnd     = true;
                    BeeImage.SetNextImage(null);
                }
            }
            else
            {
                // Set up our next image.
                m_nextImage = m_images[iNewNext];
                BeeImage.SetNextImage(m_nextImage);
            }

            return(biRet);
        }
Exemplo n.º 2
0
 public void ResetNextImage()
 {
     m_atEnd     = false;
     m_nextImage = m_images.Count > 0 ? m_images[0] : null;
     BeeImage.SetNextImage(m_nextImage);
 }