示例#1
0
        private Rendering.CachedSpriteInformation FindCachedSpriteInformation(uint spriteID)
        {
            int lastIndex = m_CachedSpriteInformations.Length - 1;
            int index     = 0;

            while (index < lastIndex)
            {
                int tmpIndex = index + lastIndex >> 1;
                var cachedSpriteInformation = m_CachedSpriteInformations.GetItemAt(tmpIndex);
                if (cachedSpriteInformation.SpriteID > spriteID)
                {
                    index = tmpIndex + 1;
                }
                else if (cachedSpriteInformation.SpriteID < spriteID)
                {
                    lastIndex = tmpIndex - 1;
                }
                else
                {
                    return(cachedSpriteInformation);
                }
            }

            return(null);
        }
示例#2
0
        internal int ExpireMessages(int ticks)
        {
            int totalExprired = 0;

            if (Visible)
            {
                int index = GetFirstNonHeaderIndex();
                while (m_Messages.Length > index)
                {
                    var message = m_Messages.GetItemAt(index);
                    if (message.VisibleSince < ticks && message.VisibleSince + message.TTL < ticks)
                    {
                        m_Messages.RemoveItemAt(index);
                        totalExprired++;
                        continue;
                    }
                    break;
                }
            }

            return(totalExprired);
        }