Exemplo n.º 1
0
        void initBoards()
        {
            var children = new List <Image>();

            for (int i = 0; i < transform.childCount; i++)
            {
                children.Add(transform.GetChild(i).GetComponent <Image>());
            }
            children.Sort((a, b) => getOrder(a.name) - getOrder(b.name));
            int index = 0;

            foreach (var child in children)
            {
                if (child.transform.parent != transform)
                {
                    continue;
                }
                if (index % numOfEdge == 0)
                {
                    _boards.Add(new List <Image>());
                    _colors.Add(new List <Color>());
                }
                _boards[index / numOfEdge].Add(child);
                _colors[index / numOfEdge].Add(child.color);
                index++;
            }

            _boards = BoardUtil.switchXY(BoardUtil.flipY(_boards));
            _colors = BoardUtil.switchXY(BoardUtil.flipY(_colors));
        }