void SetVirtual(bool loop)
{
if (!_virtual)
{
if (this.scrollPane == null)
Debug.LogError("FairyGUI: Virtual list must be scrollable!");
if (loop)
{
if (_layout == ListLayoutType.FlowHorizontal || _layout == ListLayoutType.FlowVertical)
Debug.LogError("FairyGUI: Loop list is not supported for FlowHorizontal or FlowVertical layout!");
this.scrollPane.bouncebackEffect = false;
}
_virtual = true;
_loop = loop;
_virtualItems = new List<ItemInfo>();
RemoveChildrenToPool();
if (_itemSize.x == 0 || _itemSize.y == 0)
{
GObject obj = GetFromPool(null);
if (obj == null)
{
Debug.LogError("FairyGUI: Virtual List must have a default list item resource.");
_itemSize = new Vector2(100, 100);
}
else
{
_itemSize = obj.size;
_itemSize.x = Mathf.CeilToInt(_itemSize.x);
_itemSize.y = Mathf.CeilToInt(_itemSize.y);
ReturnToPool(obj);
}
}
if (_layout == ListLayoutType.SingleColumn || _layout == ListLayoutType.FlowHorizontal)
this.scrollPane.scrollSpeed = _itemSize.y;
else
this.scrollPane.scrollSpeed = _itemSize.x;
this.scrollPane.onScroll.AddCapture(__scrolled);
SetVirtualListChangedFlag(true);
}
}