示例#1
0
        public ClickableText GetClickableText()
        {
            ItemPack _pack = GetIdlePackage(m_ClickableTextBuffer);

            if (_pack == null)
            {
                _pack = new ItemPack(ClickableText.GenerateItem(m_OriginalClickableText, m_PoolLayout));
                m_ClickableTextBuffer.Add(_pack);
            }

            _pack.isUseing = true;
            return((ClickableText)_pack.m_Item);
        }
示例#2
0
 public ChainItemPool(int initialSize, GameObject originalStarItem, GameObject originalCaptionText, GameObject originalClickableText, Transform poolLayout)
 {
     if (originalStarItem == null || originalCaptionText == null || originalClickableText == null || poolLayout == null || initialSize < 0)
     {
         throw new Exception("参数不能为null或者小于0");
     }
     m_OriginalStarItem      = originalStarItem;
     m_OriginalCaptionText   = originalCaptionText;
     m_OriginalClickableText = originalClickableText;
     m_PoolLayout            = poolLayout;
     m_StarItemBuffer        = new List <ItemPack>();
     m_CaptionTextBuffer     = new List <ItemPack>(initialSize);
     m_ClickableTextBuffer   = new List <ItemPack>();
     for (int i = 0; i < initialSize; i++)
     {
         m_CaptionTextBuffer.Add(new ItemPack(CaptionText.GenerateItem(m_OriginalCaptionText, m_PoolLayout)));
     }
     m_StarItemBuffer.Add(new ItemPack(StarItem.GenerateItem(m_OriginalStarItem, m_PoolLayout)));
     m_ClickableTextBuffer.Add(new ItemPack(ClickableText.GenerateItem(m_OriginalClickableText, m_PoolLayout)));
 }