|
|
|
@ -1,4 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Threading; |
|
|
|
|
|
|
|
namespace ConsoleApp1 |
|
|
|
{ |
|
|
|
@ -6,7 +8,48 @@ namespace ConsoleApp1 |
|
|
|
{ |
|
|
|
static void Main(string[] args) |
|
|
|
{ |
|
|
|
Console.WriteLine("Hello World!"); |
|
|
|
using (var httpClient = new HttpClient()) |
|
|
|
{ |
|
|
|
Thread.Sleep(5000); |
|
|
|
swaggerClient x = new swaggerClient("http://localhost:49746", httpClient); |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
Field r = x.NewAsync().Result; |
|
|
|
for (int ii = 0; ii < 5; ii++) |
|
|
|
{ |
|
|
|
Thread.Sleep(500); |
|
|
|
h_DrawField(r); |
|
|
|
r = x.MoveAsync(r.Identifier).Result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void h_DrawField(Field field) |
|
|
|
{ |
|
|
|
Console.Clear(); |
|
|
|
|
|
|
|
h_WriteToConsole(field.Identifier, 4, 4, ConsoleColor.Gray); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in field.Figures) |
|
|
|
{ |
|
|
|
ConsoleColor cc = item.FigureColor == 1 ? ConsoleColor.Blue : ConsoleColor.Green; |
|
|
|
h_WriteToConsole("O", item.PosX, item.PosY, cc); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private static void h_WriteToConsole(string stringToWrite, int posX, int posY, ConsoleColor cc) |
|
|
|
{ |
|
|
|
int realX = posX + 10; |
|
|
|
int realY = posY + 10; |
|
|
|
ConsoleColor oldCc = Console.ForegroundColor; |
|
|
|
Console.ForegroundColor = cc; |
|
|
|
Console.SetCursorPosition(realX, realY); |
|
|
|
Console.Write(stringToWrite); |
|
|
|
Console.ForegroundColor = oldCc; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|