コード例 #1
0
 public void DrawLoadMenu()
 {
     VirtualConsole.Clear();
     VirtualConsole.DrawBox(20, 45, 40, 2);
     VirtualConsole.Write("Load Menu", 35, 45, 9, 1);
     DrawLoadButtons();
 }
コード例 #2
0
 public void Draw()
 {
     VirtualConsole.Clear();
     VirtualConsole.DrawBox(20, 45, 40, 2);
     VirtualConsole.Write("Deckbuilding Roguelike", 30, 45, 40, 1);
     VirtualConsole.DrawBox(30, 30, 20, 2);
     VirtualConsole.Write("Start", 38, 30, 6, 1);
     VirtualConsole.DrawBox(30, 26, 20, 2);
     VirtualConsole.Write("Load", 38, 26, 5, 1);
 }
コード例 #3
0
        internal void Draw(VirtualConsole console, bool force)
        {
            foreach (var viewport in _viewportsToClear)
            {
                console.Clear(viewport);
            }

            foreach (var cdata in _components.Values
                     .Where(c => force || c.Component.NeedToRedraw != RedrawNeededAction.None))
            {
                cdata.Component.Draw(console);
            }

            _viewportsToClear.Clear();
        }
コード例 #4
0
        public void Fake_implementation_of_console_can_be_used_to_execute_commands_in_isolation()
        {
            // Arrange
            using MemoryStream stdIn  = new(Console.InputEncoding.GetBytes("input"));
            using MemoryStream stdOut = new();
            using MemoryStream stdErr = new();

            using IConsole console = new VirtualConsole(input: stdIn,
                                                        output: stdOut,
                                                        error: stdErr);

            // Act
            console.Output.Write("output");
            console.Error.Write("error");

            var stdInData  = console.Input.ReadToEnd();
            var stdOutData = console.Output.Encoding.GetString(stdOut.ToArray());
            var stdErrData = console.Error.Encoding.GetString(stdErr.ToArray());

            console.Clear();
            console.ResetColor();
            console.ForegroundColor = ConsoleColor.DarkMagenta;
            console.BackgroundColor = ConsoleColor.DarkMagenta;
            console.CursorLeft      = 42;
            console.CursorTop       = 24;
            console.BufferHeight    = 80;
            console.BufferWidth     = 120;
            console.WindowWidth     = 45;
            console.WindowHeight    = 70;

            console.SetCursorPosition(24, 42);

            // Assert
            stdInData.Should().Be("input");
            stdOutData.Should().Be("output");
            stdErrData.Should().Be("error");

            console.Input.Should().NotBeSameAs(Console.In);
            console.Output.Should().NotBeSameAs(Console.Out);
            console.Error.Should().NotBeSameAs(Console.Error);

            console.Input.IsRedirected.Should().BeTrue();
            console.Output.IsRedirected.Should().BeTrue();
            console.Error.IsRedirected.Should().BeTrue();

            console.ForegroundColor.Should().NotBe(Console.ForegroundColor);
            console.BackgroundColor.Should().NotBe(Console.BackgroundColor);
        }
コード例 #5
0
ファイル: Task.cs プロジェクト: MaGiiC123/CodingGame
 public void StartTask(string code)
 {
     this.code = code;
     StartCoroutine(StartTaskRoutine());
     VirtualConsole.Clear();
 }