Example #1
0
        public RenderableDot[][] GetRenderable()
        {
            var generator = new RenderableDotGenerator();

            var fromTop   = 5;
            var fromSides = 10;
            var width     = Console.WindowWidth - (10 * 2);

            var lines = SplitStringToLength(message, width);

            generator.SetPosition(fromSides, fromTop);

            foreach (var line in lines)
            {
                generator.Write(line);
                generator.IncrementY();
            }

            generator.IncrementY();

            /*var buttonWidth = buttonLabel.Length + 4;
             * generator.SetX((Console.WindowWidth / 2) - buttonWidth/2);
             * generator.Write($"  {buttonLabel}  ", ConsoleColor.Blue);*/

            GetButtons(generator);

            return(generator.GetRenderableDots());
        }
Example #2
0
        protected virtual void GetButtons(RenderableDotGenerator generator)
        {
            var fullButton  = $"  {buttonLabel}  ";
            var buttonWidth = fullButton.Length;

            generator.SetX((Console.WindowWidth / 2) - buttonWidth / 2);
            generator.Write(fullButton, ConsoleColor.Blue);
        }
Example #3
0
        public RenderableDot[][] GetRenderable()
        {
            var generator = new RenderableDotGenerator();

            generator.SetPosition(10, 5);

            foreach (var option in options)
            {
                generator.Write(option + "\n");
            }

            generator.SetPosition(5, 5 + this.selected);
            generator.Write("-->", ConsoleColor.Black, ConsoleColor.Green);

            return(generator.GetRenderableDots());
        }
Example #4
0
        protected override void GetButtons(RenderableDotGenerator generator)
        {
            var totalLength = buttons.Sum(x => x.Length) + (4 * buttons.Length) + (buttons.Length - 1);

            generator.SetX((Console.WindowWidth / 2) - totalLength / 2);

            for (int i = 0; i < buttons.Length; i++)
            {
                var color = ConsoleColor.Black;
                if (i == currentButton)
                {
                    color = ConsoleColor.Blue;
                }

                generator.Write($"  {buttons[i]}  ", color);
            }
        }
Example #5
0
        public RenderableDot[][] GetRenderable()
        {
            var generator = new RenderableDotGenerator();

            var maxQuestionLength = questions.Max().Length;

            for (var i = 0; i < questions.Length; i++)
            {
                generator.SetPosition(5, 3 + i);
                generator.Write(questions[i]);

                generator.SetPosition(maxQuestionLength + 4, 3 + i);

                generator.Write(": ");
                generator.Write((answers[i] ?? ""));

                if (i == currentQuestion)
                {
                    generator.Write("▌");
                }
            }

            return(generator.GetRenderableDots());
        }
Example #6
0
 public VirtualConsole()
 {
     currentState = new RenderableDotGenerator().GetRenderableDots();
 }