Exemplo n.º 1
0
        private static void PrintGameMenu()
        {
            Console.WriteLine(new string('-', Console.BufferWidth - 1));
            MaptileInfo tileInfo = map.SelectedTile;

            PrintKeys(tileInfo);
            PrintCurrentTeamInfo(map.CurrentTeam);
            PrintTileInformation(tileInfo);
        }
Exemplo n.º 2
0
        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})");
        }
Exemplo n.º 3
0
        private static void PrintTileInformation(MaptileInfo tileInfo)
        {
            if (tileInfo.ContainsUnit)
            {
                PrintLandtileAndUnitTitle(tileInfo);
            }
            else
            {
                PrintLandtileTitle(tileInfo);
            }

            if (tileInfo.ContainsUnit)
            {
                PrintUnitInfo(tileInfo.Unit);
            }
        }
Exemplo n.º 4
0
        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})");
        }
Exemplo n.º 5
0
 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("");
 }
Exemplo n.º 6
0
        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);
        }