예제 #1
0
        public UIWrapGrid(GameObject cellPrefab, int dataCount)
        {
            if (null == cellPrefab)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] cellPrefab = Null!");
            }

            var content = cellPrefab.transform.parent;

            if (null == content)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] cellPrefab.parent = Null!");
            }

            var viewPort = content.transform.parent;

            if (null == viewPort)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] cellPrefab.parent.parent = Null!");
            }

            GridContent = viewPort.GetComponent <UIWrapGridContent>();
            if (GridContent == null)
            {
                Console.Error.WriteLine("[UIWrapGrid Error] No has UIWrapGridContent");
            }

            _CreateItemPools(cellPrefab);
            _gridSize = dataCount;
            GridContent.Init(this);
        }