static void Main(string[] args)
        {
            ConsoleGrid g = new ConsoleGrid();

            Console.WriteLine("Enter Grid Row/Column Size (int): ");
            string size = Console.ReadLine();

            while (size.ToLower() != "e")
            {
                if (size == "")
                {
                    g = new ConsoleGrid();
                    g.Draw();
                }
                else if (size.ToLower() == "v")
                {
                    g.Evaluate();
                    g.Draw();
                }
                else
                {
                    g = new ConsoleGrid(Convert.ToInt32(size));
                    g.Draw();
                }
                Console.WriteLine("\n\nInput new size to Generate new Grid/CableTiles\n[E to Exit | V to Evaluate Next Tiles]");
                size = Console.ReadLine();
            }
        }
示例#2
0
    //Copies the data of a Block into this DraggableBlock’s contained Block
    public void Init(Block copiedBlock, Grid newGrid, RectTransform canvas, ConsoleGrid newConsoleGrid)
    {
        grid        = newGrid;
        consoleGrid = newConsoleGrid;
        consoleGrid.Init();
        draggableObject.SetCanvasTransform(canvas);

        //nonDraggingScale = new Vector3(0.75f, 0.75f, 0.75f);
        nonDraggingScale = new Vector3(1f, 1f, 1f);
        //draggingScale = new Vector3(1.0f, 1.0f, 1.0f);

        float scaleVlaueY = grid.GetTileHeight() / consoleGrid.GetTileHeight();
        float scaleVlaueX = grid.GetTileWidth() / consoleGrid.GetTileWidth();

        draggingScale = new Vector3(scaleVlaueX, scaleVlaueY, 1.0f);

        draggableObject.SetDraggingScale(draggingScale);
        draggableObject.SetNonDraggingScale(nonDraggingScale);

        //transform.localScale = nonDraggingScale;

        transform.SetParent(consoleGrid.transform);

        // Copy the copiedBlock data into this DraggableBlock's block.
        block = new Block(copiedBlock);

        /*
         * block = new Block(copiedBlock.GetHeight(), copiedBlock.GetWidth());
         * for (int r = 0; r < block.GetHeight(); r++)
         * {
         *  for (int c = 0; c < block.GetWidth(); c++)
         *  {
         *      block.Fill(r, c, copiedBlock.GetTileType(r, c));
         *
         *      //tiles[r, c].GetComponent<RectTransform>().SetParent(transform);
         *  }
         * }
         */

        UpdateTiles();
    }