예제 #1
0
        private static void RenderToConsole(UniversalGrid <char> grid)
        {
            Console.Clear();
            Console.WriteLine();

            var r = -1;

            grid.Render((p, m) =>
            {
                if (p.Y > r)
                {
                    //if(r > -1) Console.Write("|");

                    Console.WriteLine();
                    Console.Write(p.Y.ToString().PadRight(3));
                    Console.Write("|");
                }

                if (m.Any())
                {
                    Console.Write("O");
                }
                else
                {
                    Console.Write(" ");
                }

                Console.Write("|");

                r = p.Y;
            });

            Console.WriteLine();
        }
예제 #2
0
        public void Write(UniversalGrid <T> grid)
        {
            var r = grid.TopLeft.Y - 1;
            var c = -1;

            _textFormatter.WriteStartGrid(grid);

            grid.Render((p, x) =>
            {
                if (p.Y > r)
                {
                    if (r > -1)
                    {
                        _textFormatter.WriteEndRow();
                    }
                    _textFormatter.WriteStartRow(p.Y - grid.TopLeft.Y);
                    c = 0;
                }

                _textFormatter.WriteCell(p, c, x);

                c++;
                r = p.Y;
            });

            if (r > -1)
            {
                _textFormatter.WriteEndRow();
            }

            _textFormatter.WriteEndGrid();
        }
예제 #3
0
        private int RenderToConsole(UniversalGrid <int> grid)
        {
            Console.WriteLine();

            int c = 0;
            var r = -1;

            grid.Render((p, m) =>
            {
                c++;

                if (p.Y > r)
                {
                    Console.WriteLine();
                    Console.Write(p.Y + "\t");
                }

                Console.Write("|\t");

                if (m.Any())
                {
                    foreach (var i in m)
                    {
                        Console.Write(i.Label);
                    }
                }

                Console.Write("\t");

                r = p.Y;
            });

            Console.WriteLine();

            return(c);
        }