void BoardCreate()
    {
        groups = new Dictionary <int, CellGroup>();
        Lib.RemoveObjects(rootCells);

        // create groups for each piece and places them in the starting position
        for (int y = 0; y < sizeBoardY; y++)
        {
            for (int x = 0; x < sizeBoardX; x++)
            {
                CellGroup group = Lib.AddObject <CellGroup>(prefGroup, rootCells, true);
                group.index = x + y * sizeBoardX;
                Cell cell = group.cells[0];

                DC_Cell data = new DC_Cell();
                data.posX       = x;
                data.posY       = y;
                data.sizeBoardX = sizeBoardX;
                data.sizeBoardY = sizeBoardY;
                data.sizePictX  = pictBack.localScale.x;
                data.sizePictY  = pictBack.localScale.y;
                data.sizeCellX  = sizeCellX;
                data.sizeCellY  = sizeCellY;

                cell.SetData(data);
                cell.draw.SetData(data);
                group.UpdateIndex();
                groups.Add(group.index, group);
                cell.mesh.gameObject.SetActive(false);
            }
        }

        // generates texture with pieces of puzzle
        StartCoroutine(DrawingCells());
    }
    // set game data when loading windows
    void SetData(object[] args)
    {
        GameType game = (GameType)args [0];

        labelTitle.text = game.title;           // название

        // картинки
        foreach (Sprite image in game.images)
        {
            UIImageItem item = Lib.AddObject <UIImageItem>(prefImage, rootImages);
            item.SetData(image);
        }
    }
Example #3
0
    void BoardStartGame(object[] args)
    {
        // load game
        image = (Sprite)args [0];               // picture

        Lib.RemoveObjects(rootScene);
        // load the game from the content list
        Board board = Lib.AddObject <Board>(content.games [gameID].board, rootScene);

        board.SendMessage("SetData", SendMessageOptions.DontRequireReceiver);

        // load the game interface window
        UIRoot.CloseAll();
        UIRoot.Load(WindowName.Win_Board);
    }