Ejemplo n.º 1
0
        public override void Init()
        {
            base.Init();

            // record the item size
            IUListItemView itemView = itemPrefab.GetComponent <IUListItemView>();

            itemSize = itemView.GetItemSize(-1);

            // record max numbers per row/column
            numPerRow    = m_MaxRow;
            numPerColumn = m_MaxCol;

            if (numPerRow < 1)
            {
                numPerRow = (int)(scrollRectSize.x / (itemSize.x + spacing.x));
            }

            if (numPerColumn < 1)
            {
                numPerColumn = (int)(scrollRectSize.y / (itemSize.y + spacing.y));
            }

            if (numPerRow < 1 || numPerColumn < 1)
            {
                Debug.LogError("ScrollRect size is too small to contain even one item");
            }

            // to make items center aligned
            //padding = Vector2.zero;

            // spawn pool for listitems
            lstItems = new List <GameObject>();
        }
Ejemplo n.º 2
0
        public override void Init()
        {
            base.Init();

            // record the item size
            IUListItemView itemView = itemPrefab.GetComponent <IUListItemView> ();

            itemSize = itemView.GetItemSize(-1);

            // spawn pool for listitems
            lstItems = new List <GameObject> ();
        }
Ejemplo n.º 3
0
		public override void Init ()
		{
			base.Init ();
			lstItems = new List<GameObject> ();
			itemView = itemPrefab.GetComponent<IUListItemView>();
		}