예제 #1
0
        protected virtual ScrollElement SpawnElement()
        {
            ScrollElement element;

            if (m_PoolOfElements.Count > 0)
            {
                element = m_PoolOfElements.First.Value;
                m_PoolOfElements.RemoveFirst();
            }
            else
            {
                RectTransform         newElementRect = GameObject.Instantiate <RectTransform>(m_SampleElement);
                BaseScrollFormElement elementScript  = newElementRect.GetComponent <BaseScrollFormElement>();
                element = new ScrollElement(newElementRect, elementScript);
            }
            element.rect.gameObject.active = true;
            return(element);
        }
예제 #2
0
 public ScrollElement(RectTransform inRect, BaseScrollFormElement inScript)
 {
     rect   = inRect;
     script = inScript;
     idx    = -1;
 }