private static void PrintGameMenu() { Console.WriteLine(new string('-', Console.BufferWidth - 1)); MaptileInfo tileInfo = map.SelectedTile; PrintKeys(tileInfo); PrintCurrentTeamInfo(map.CurrentTeam); PrintTileInformation(tileInfo); }
private static void PrintLandtileTitle(MaptileInfo tileInfo) { Landtile landtile = tileInfo.Land; Console.Write("["); WriteColored(landtile.ConsoleImage); Console.Write("] "); string name = tileInfo.Land.DisplayedName; Console.WriteLine(name + $"({map.SelectedTileX}; {map.SelectedTileY})"); }
private static void PrintTileInformation(MaptileInfo tileInfo) { if (tileInfo.ContainsUnit) { PrintLandtileAndUnitTitle(tileInfo); } else { PrintLandtileTitle(tileInfo); } if (tileInfo.ContainsUnit) { PrintUnitInfo(tileInfo.Unit); } }
private static void PrintLandtileAndUnitTitle(MaptileInfo tileInfo) { Landtile landtile = tileInfo.Land; Console.Write("["); WriteColored(landtile.ConsoleImage); Console.Write("]"); Unit unit = tileInfo.Unit; Console.Write("["); WriteColored(tileInfo.Unit.ConsoleImage); Console.Write("]"); string landtileName = tileInfo.Land.DisplayedName; string unitName = tileInfo.Unit.DisplayedName; Console.WriteLine(" " + landtileName + "/" + unitName + $"({map.SelectedTileX}; {map.SelectedTileY})"); }
private static void PrintKeys(MaptileInfo tileInfo) { Console.Write(buttonsInstruction); if (tileInfo.ContainsUnit || map.UnitSelected) { Console.Write(buttonsEnter); } if (map.UnitSelected) { if (tileInfo.AvailableForSelectedUnitMove) { Console.Write(buttonsSpace); } Console.Write(buttonsEscape); } Console.WriteLine(""); }
private static void StartGame(string rulesPath, string mapPath) { map = InitializeMap(rulesPath, mapPath); do { Console.Clear(); PrintMapScreen(); PrintGameMenu(); ConsoleKeyInfo input = Console.ReadKey(true); MaptileInfo selectedTileInfo = map.SelectedTile; // Нет проверок на выделенный тайл, // потому что играю от API. if (input.Key == ConsoleKey.DownArrow) { ++map.SelectedTileY; } else if (input.Key == ConsoleKey.UpArrow) { --map.SelectedTileY; } else if (input.Key == ConsoleKey.LeftArrow) { --map.SelectedTileX; } else if (input.Key == ConsoleKey.RightArrow) { ++map.SelectedTileX; } else if (input.Key == ConsoleKey.Enter) { if (map.UnitSelected) { map.ConfirmSelectedUnitRoute(); } else if (map.SelectedTile.ContainsUnit) { map.SelectUnit(); } } else if (input.Key == ConsoleKey.Spacebar) { map.AddSelectedUnitRoute(); } else if (input.Key == ConsoleKey.Escape) { map.UnselectUnit(); } else if (input.Key == ConsoleKey.T) { map.MakeTurn(); } else if (input.Key == ConsoleKey.P) { map.PassTurn(); } } while (true); }