Advertisement
Vadim_Rogulev

Untitled

Apr 27th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 31.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using System.Threading;
  8.  
  9. namespace Творческое_задание
  10. {
  11.  
  12.     class Program
  13.     {
  14.         static bool Fortress = true;//крепость не разрушена
  15.         static bool Max_Fort = false;//достигнут максимальный уровень
  16.         static int Number_Fort = 0;//уровень крепости
  17.         static int Fort = 10;//переменная крепости
  18.         static int Fort_1 = 0;//переменная крепости после первого улучшения
  19.         static int Fort_2 = 0;//переменная крепости после второго улучшения
  20.         static int Fort_3 = 0;//переменная крепости после третьего улучшения
  21.         static bool Sawmill = false;//постройка лесопилки
  22.         static bool Max_Sa = false;//достигнут максимальный уровень
  23.         static int Number_Sa = 0;//уровень крепости
  24.         static int Sa = 0;//переменная добычи дерева
  25.         static int Sa_1 = 0;//переменная добычи дерева после первого улучшения
  26.         static int Sa_2 = 0;//переменная добычи дерева после второго улучшения
  27.         static int Sa_3 = 0;//переменная добычи дерева после третьего улучшения
  28.         static bool Farm = false;//постройка фермы
  29.         static bool Max_Fa = false;//достигнут максимальный уровень
  30.         static int Number_Fa = 0;//уровень крепости
  31.         static int Fa = 0;//переменная добычи еды
  32.         static int Fa_1 = 0;//переменная добычи еды после первого улучшения
  33.         static int Fa_2 = 0;//переменная добычи еды после второго улучшения
  34.         static int Fa_3 = 0;//переменная добычи еды после третьего улучшения
  35.         static bool Stone_quarry = false;//постройка каменолони
  36.         static bool Max_Sq = false;//достигнут максимальный уровень
  37.         static int Number_Sq = 0;//уровень крепости
  38.         static int Sq = 0;//переменная добычи камня
  39.         static int Sq_1 = 0;//переменная добычи камня после первого улучшения
  40.         static int Sq_2 = 0;//переменная добычи камня после второго улучшения
  41.         static int Sq_3 = 0;//переменная добычи камня после третьего улучшения
  42.         static bool House_1 = false;//постройка дома_1
  43.         static bool Max_Ho_1 = false;//достигнут максимальный уровень
  44.         static int Number_Ho_1 = 0;//уровень крепости
  45.         static int Ho_1 = 0;//переменная койко-мест первого дома
  46.         static int Ho_1_1 = 0;//переменная койко-мест первого дома после первого улучшения
  47.         static int Ho_1_2 = 0;//переменная койко-мест первого дома после второго улучшения
  48.         static int Ho_1_3 = 0;//переменная койко-мест первого дома третьего улучшения
  49.         static bool House_2 = false;//постройка дома_2
  50.         static bool Max_Ho_2 = false;//достигнут максимальный уровень
  51.         static int Number_Ho_2 = 0;//уровень крепости
  52.         static int Ho_2 = 0;//переменная койко-мест второго дома
  53.         static int Ho_2_1 = 0;//переменная койко-мест второго дома после первого улучшения
  54.         static int Ho_2_2 = 0;//переменная койко-мест второго дома после второго улучшения
  55.         static int Ho_2_3 = 0;//переменная койко-мест второго дома третьего улучшения
  56.         static bool House_3 = false;//постройка дома_3
  57.         static bool Max_Ho_3 = false;//достигнут максимальный уровень
  58.         static int Number_Ho_3 = 0;//уровень крепости
  59.         static int Ho_3 = 0;//переменная койко-мест третьего дома
  60.         static int Ho_3_1 = 0;//переменная койко-мест третьего дома после первого улучшения
  61.         static int Ho_3_2 = 0;//переменная койко-мест третьего дома после второго улучшения
  62.         static int Ho_3_3 = 0;//переменная койко-мест третьего дома третьего улучшения
  63.         static bool Forge = false;//постройка кузницы
  64.         static bool Max_Fo = false;//достигнут максимальный уровень
  65.         static int Number_Fo = 0;//уровень крепости
  66.         static int Fo = 0;//переменная добычи метала
  67.         static int Fo_1 = 0;//переменная добычи метала после первого улучшения
  68.         static int Fo_2 = 0;//переменная добычи метала после второго улучшения
  69.         static int Fo_3 = 0;//переменная добычи метала третьего улучшения
  70.         static bool Casern = false;//постройка казармы
  71.         static bool Max_Ca = false;//достигнут максимальный уровень
  72.         static int Number_Ca = 0;//уровень крепости
  73.         static int Ca = 0;//переменная силы войск
  74.         static int Ca_1 = 0;//переменная силы войск после первого улучшения
  75.         static int Ca_2 = 0;//переменная силы войск после второго улучшения
  76.         static int Ca_3 = 0;//переменная силы войск третьего улучшения
  77.         static bool Chapel = false;//постройка часовни
  78.         static bool Max_Ch = false;//достигнут максимальный уровень
  79.         static int Number_Ch = 0;//уровень крепости
  80.         static int Ch = 0;//переменная силы веры
  81.         static int Ch_1 = 0;//переменная силы веры после первого улучшения
  82.         static int Ch_2 = 0;//переменная силы веры после второго улучшения
  83.         static int Ch_3 = 0;//переменная силы веры третьего улучшения
  84.         static int Gold = 15;
  85.         static int Tree = 15;
  86.         static int Stone = 0;
  87.         static int Metal = 0;
  88.         static int People = 10;
  89.         static int Food = 10;
  90.         static readonly object locker = new object();
  91.         static void Main(string[] args)
  92.         {
  93.  
  94.  
  95.             int Item_Selection = 0;
  96.             new Thread(Resource_count).Start();
  97.            
  98.             while (true)
  99.             {
  100.                 Console.Clear();
  101.                 Frame("frame.txt");// если простроено...
  102.                 Console.SetCursorPosition(18, 2);
  103.                 Console.WriteLine("Золото: " + Gold + " Дерево: " + Tree + " Камень: " + Stone + " Метал: " + Metal + "             Крестьяне: " + People + " Еда: " + Food);
  104.                 ConsoleKeyInfo key;
  105.                 if (Console.KeyAvailable)
  106.                 {
  107.                     key = Console.ReadKey(true);
  108.                     switch (key.Key)
  109.                     {
  110.                         case ConsoleKey.Escape:
  111.                             Console.Clear();
  112.                             Menu(ref Item_Selection, "main_menu.txt");
  113.                             switch (Item_Selection)
  114.                             {
  115.                                 case 1://создание новых строений
  116.                                     Console.Clear();
  117.                                     Menu(ref Item_Selection, "buildings_menu.txt");
  118.                                     switch (Item_Selection)
  119.                                     {
  120.                                         case 1://разобраться с экономикой// строим Лесопилку
  121.                                             Building(ref Item_Selection, "Sawmill.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Sawmill, 10, 10, 0, 0, 2, 2, ref Sa, 2);
  122.                                            
  123.                                                     break;
  124.                                         case 2://разобраться с экономикой// строим Ферму
  125.                                             Building(ref Item_Selection, "Farm.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Farm, 15, 35, 0, 0, 2, 4, ref Fa, 3);
  126.                                            
  127.                                             break;
  128.                                         case 3://разобраться с экономикой// строим Каменоломню
  129.                                             Building(ref Item_Selection, "Stone_quarry.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Stone_quarry, 20, 50, 0, 0, 3, 10, ref Sq, 2);
  130.                                            
  131.                                             break;
  132.                                         case 4://разобраться с экономикой// строим Дом_1
  133.                                             Building(ref Item_Selection, "House_1.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref House_1, 10, 30, 0, 0, 0, 5, ref Ho_1, 5);
  134.                                            
  135.                                             break;
  136.                                         case 5://разобраться с экономикой// строим Дом_2
  137.                                             Building(ref Item_Selection, "House_2.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref House_2, 20, 30, 15, 0, 0, 10, ref Ho_2, 5);
  138.                                            
  139.                                             break;
  140.                                         case 6://разобраться с экономикой// строим Дом_3
  141.                                             Building(ref Item_Selection, "House_3.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref House_3, 30, 15, 25, 0, 0, 10, ref Ho_3, 5);
  142.                                            
  143.                                             break;
  144.                                         case 7://разобраться с экономикой// строим Кузницу
  145.                                             Building(ref Item_Selection, "Forge.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Forge, 30, 45, 50, 0, 5, 20, ref Fo, 1);
  146.                                            
  147.                                             break;
  148.                                         case 8://разобраться с экономикой// строим Казармы
  149.                                             Building(ref Item_Selection, "Casern.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Casern, 100, 50, 70, 30, 20, 100, ref Ca, 0);
  150.                                            
  151.                                             break;
  152.                                         case 9://разобраться с экономикой// строим Часовню
  153.                                             Building(ref Item_Selection, "Chapel.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Chapel, 50, 50, 30, 20, 10, 30, ref Ch, 9);
  154.                                            
  155.                                             break;
  156.                                         case 10:
  157.                                             break;
  158.                                     }
  159.                                     break;
  160.                                 case 2://улучшение строений
  161.                                     Console.Clear();
  162.                                     Menu(ref Item_Selection, "improvement_menu.txt");
  163.                                     switch (Item_Selection)
  164.                                     {
  165.  
  166.                                         case 1:// улучшаем крепость
  167.                                             Improvement(ref Item_Selection, "Fortress _improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Fortress, ref Max_Fort, 50, 50, 50, 5, 10, 50, ref Fort_1, ref Fort_2, ref Fort_3, 2, ref Number_Fort);
  168.                                             break;
  169.                                         case 2:// улучшаем лесопилку
  170.                                             Improvement(ref Item_Selection, "Sawmill _improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Sawmill, ref Max_Sa, 10, 10, 10, 1, 1, 10, ref Sa_1, ref Sa_2, ref Sa_3, 3, ref Number_Sa);
  171.  
  172.                                             break;
  173.                                         case 3:// улучшаем ферму
  174.                                             Improvement(ref Item_Selection, "Farm _improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Farm, ref Max_Fa, 15, 15, 15, 1, 1, 15, ref Fa_1, ref Fa_2, ref Fa_3, 5, ref Number_Fa);
  175.  
  176.                                             break;
  177.                                         case 4:// улучшаем каменоломню
  178.                                             Improvement(ref Item_Selection, "Stone_quarry_improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Stone_quarry, ref Max_Sq, 30, 30, 30, 5, 1, 15, ref Sq_1, ref Sq_2, ref Sq_3, 3, ref Number_Sq);
  179.  
  180.                                             break;
  181.                                         case 5:// улучшаем Дом_1
  182.                                             Improvement(ref Item_Selection, "House_1_improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref House_1, ref Max_Ho_1, 20, 20, 20, 1, 0, 15, ref Ho_1_1, ref Ho_1_2, ref Ho_1_3, 2, ref Number_Ho_1);
  183.  
  184.                                             break;
  185.                                         case 6:// улучшаем Дом_2
  186.                                             Improvement(ref Item_Selection, "House_2_improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref House_2, ref Max_Ho_2, 20, 20, 20, 1, 0, 15, ref Ho_2_1, ref Ho_2_2, ref Ho_2_3, 2, ref Number_Ho_2);
  187.  
  188.                                             break;
  189.                                         case 7:// улучшаем Дом_3
  190.                                             Improvement(ref Item_Selection, "House_3_improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref House_3, ref Max_Ho_3, 20, 20, 20, 1, 0, 15, ref Ho_3_1, ref Ho_3_2, ref Ho_3_3, 2, ref Number_Ho_3);
  191.  
  192.                                             break;
  193.                                         case 8:// улучшаем Кузницу
  194.                                             Improvement(ref Item_Selection, "Forge _improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Forge, ref Max_Fo, 50, 50, 50, 5, 5, 25, ref Fo_1, ref Fo_2, ref Fo_3, 3, ref Number_Fo);
  195.  
  196.                                             break;
  197.                                         case 9:// улучшаем Казармы
  198.                                             Improvement(ref Item_Selection, "Casern _improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Casern, ref Max_Ca, 50, 50, 50, 5, 10, 50, ref Ca_1, ref Ca_2, ref Ca_3, 2, ref Number_Ca);
  199.  
  200.                                             break;
  201.                                         case 10:// улучшаем Часовню
  202.                                             Improvement(ref Item_Selection, "Chapel _improvement.txt", ref Gold, ref Tree, ref Stone, ref Metal, ref People, ref Food, ref Chapel, ref Max_Ch, 100, 20, 20, 2, 1, 15, ref Ch_1, ref Ch_2, ref Ch_3, 2, ref Number_Ch);
  203.  
  204.                                             break;
  205.                                         case 11:
  206.                                             break;
  207.                                     }
  208.                                     break;
  209.                                 case 3://информация о строениях
  210.                                     Console.Clear();
  211.                                     Information(ref Fortress, ref Number_Fort, "Крепость уровня");
  212.                                     Information(ref Sawmill, ref Number_Sa, "Лесопилка уровня");
  213.                                     Information(ref Farm, ref Number_Fa, "Ферма уровня");
  214.                                     Information(ref Stone_quarry, ref Number_Sq, "Каменоломня уровня");
  215.                                     Information(ref House_1, ref Number_Ho_1, "Дом_1 уровня");
  216.                                     Information(ref House_2, ref Number_Ho_2, "Дом_2 уровня");
  217.                                     Information(ref House_3, ref Number_Ho_3, "Дом_3 уровня");
  218.                                     Information(ref Forge, ref Number_Fo, "Кузница уровня");
  219.                                     Information(ref Casern, ref Number_Ca, "Казармы уровня");
  220.                                     Information(ref Chapel, ref Number_Ch, "Часовня уровня");
  221.                                     Console.ReadKey();
  222.                                     break;
  223.                                 case 4:
  224.                                     Console.WriteLine("Будет чуть позже");
  225.                                     Console.ReadKey();
  226.                                     break;
  227.                                 case 5:
  228.                                     Console.WriteLine("Будет чуть позже");
  229.                                     Console.ReadKey();
  230.                                     break;
  231.                                 case 6:
  232.                                     Console.WriteLine("Будет чуть позже");
  233.                                     Console.ReadKey();
  234.                                     break;
  235.                                 case 7:
  236.                                     Console.WriteLine("Будет чуть позже");
  237.                                     Console.ReadKey();
  238.                                     break;
  239.                                 case 8:
  240.                                     Console.WriteLine("Будет чуть позже");
  241.                                     Console.ReadKey();
  242.                                     break;
  243.                                 case 9://выход из игры
  244.                                     Console.Clear();
  245.                                     Menu(ref Item_Selection, "Exit.txt");
  246.                                     if (Item_Selection == 1)
  247.                                     {
  248.                                         return;
  249.                                     }
  250.                                     break;
  251.                                 case 10://выход из меню
  252.                                    
  253.                                     break;
  254.                             }
  255.                             break;
  256.                     }
  257.                 }
  258.                 System.Threading.Thread.Sleep(2000);//1секунда = 1000 милисекунд
  259.  
  260.             }
  261.         }
  262.  
  263.  
  264.         static void Resource_count()
  265.         {
  266.             lock (locker)
  267.             {
  268.                 while (true)
  269.                 {
  270.                     System.Threading.Thread.Sleep(30000);
  271.  
  272.                     Gold = Gold + 1 + Fort_1 + Fort_2 + Fort_3 + Ch + Ch_1 + Ch_2 + Ch_3;
  273.                     if (Sawmill == true)
  274.                     {
  275.                         Tree = Tree + Sa + Sa_1 + Sa_2 + Sa_3;
  276.                     }
  277.                     if (Stone_quarry == true)
  278.                     {
  279.                         Stone = Stone + Sq + Sq_1 + Sq_2 + Sq_3;
  280.                     }
  281.                     if (Forge == true)
  282.                     {
  283.                         Metal = Metal + Fo + Fo_1 + Fo_2 + Fo_3;
  284.                     }
  285.                     if (People < (Fort + Fort_1 + Fort_2 + Fort_3 + Ho_1 + Ho_1_1 + Ho_1_2 + Ho_1_3 + Ho_2 + Ho_2_1 + Ho_2_2 + Ho_2_3 + Ho_3 + Ho_3_1 + Ho_3_2 + Ho_3_3))
  286.                     {
  287.                         People += 1;
  288.                     }
  289.                     Food = Food + 1 + Fort_1 + Fort_2 + Fort_3 + Fa + Fa_1 + Fa_2 + Fa_3;
  290.                 }
  291.             }
  292.         }
  293.         static void Frame(string Input_File)
  294.         {
  295.             Console.CursorVisible = false;//прячем мигающий курсор
  296.             string[] Frame = File.ReadAllLines(Input_File, System.Text.Encoding.GetEncoding(1251));//вызывается массив из файла и переводится в Unicode
  297.             char[,] FrameChar = new char[Frame.Length, Frame[1].Length];
  298.             for (int i = 0; i < FrameChar.GetLength(0); i++)
  299.                 for (int j = 0; j < FrameChar.GetLength(1); j++)
  300.                     FrameChar[i, j] = Frame[i][j];//присвоение всех элементов массива нового файла массиву интерфейса
  301.             for (int i = 0; i < FrameChar.GetLength(0); i++)
  302.             {
  303.                 for (int j = 0; j < FrameChar.GetLength(1); j++)
  304.                 {
  305.                     Console.Write(FrameChar[i, j]);
  306.                 }
  307.                 Console.WriteLine();
  308.             }
  309.         }
  310.         static void Menu(ref int Item_Selection, string Input_File)
  311.         {
  312.             bool Input = true;//запуск стика
  313.             Item_Selection = 1;//выбираемый элемент
  314.             Console.CursorVisible = false;//прячем мигающий курсор
  315.             string[] newFile = File.ReadAllLines(Input_File, System.Text.Encoding.GetEncoding(1251));//вызывается массив из файла и переводится в Unicode
  316.             char[,] Interface = new char[newFile.Length, newFile[1].Length];
  317.  
  318.             int CursorX = 0, CursorY = 0;//ввод положения курсора
  319.             int DY = 0;//изминение положение курсора (вертикальное)
  320.             for (int i = 0; i < Interface.GetLength(0); i++)
  321.                 for (int j = 0; j < Interface.GetLength(1); j++)
  322.                     Interface[i, j] = newFile[i][j];//присвоение всех элементов массива нового файла массиву интерфейса
  323.             for (int i = 0; i < Interface.GetLength(0); i++)
  324.             {
  325.                 for (int j = 0; j < Interface.GetLength(1); j++)
  326.                 {
  327.                     if (Interface[i, j] == 'O')
  328.                     {
  329.                         CursorX = j;
  330.                         CursorY = i;
  331.                         Interface[i, j] = ' ';
  332.                     }
  333.                     Console.Write(Interface[i, j]);
  334.                 }
  335.                 Console.WriteLine();
  336.             }
  337.             Console.SetCursorPosition(4, CursorY - 2);
  338.             Console.Write(' ');//убираем верхний блок
  339.             Console.SetCursorPosition(4, Interface.GetLength(0) - 1);
  340.             Console.Write(' ');//убираем нижний блок
  341.             Console.SetCursorPosition(CursorX, CursorY);
  342.             Console.Write('O');
  343.             ConsoleKeyInfo key;
  344.             while (Input == true)
  345.             {
  346.                 key = Console.ReadKey(true);
  347.                 switch (key.Key)
  348.                 {
  349.                     case ConsoleKey.UpArrow:
  350.                         DY -= 2;
  351.                         if (Interface[CursorY + DY, CursorX] != '#')
  352.                         {
  353.                             Item_Selection--;
  354.                         }
  355.                         break;
  356.                     case ConsoleKey.DownArrow:
  357.                         DY += 2;
  358.                         if (Interface[CursorY + DY, CursorX] != '#')
  359.                         {
  360.                             Item_Selection++;
  361.                         }
  362.                         break;
  363.                     case ConsoleKey.Enter:
  364.                         Input = false;
  365.                         break;
  366.                 }
  367.  
  368.                 //Console.SetCursorPosition(10, 20);
  369.                 //Console.Write($"Выбор элемента {Item_Selection}"); //проверка выводимого значения
  370.  
  371.                 if (Interface[CursorY + DY, CursorX] != '#')
  372.                 {
  373.                     Console.SetCursorPosition(CursorX, CursorY);
  374.                     Console.Write(' ');//затираем курсор
  375.                     CursorY = CursorY + DY;//передвигаем его на новое положение
  376.                     Console.SetCursorPosition(CursorX, CursorY);
  377.                     Console.Write('O');//отображаем курсор вновь
  378.                 }
  379.                 DY = 0;
  380.  
  381.             }
  382.         }
  383.         static void Building (ref int Item_Selection, string Input_File, ref int Gold, ref int Tree, ref int Stone, ref int Metal, ref int People, ref int Food, ref bool Bu, int Price_Gold, int Price_Tree, int Price_Stone, int Price_Metal, int Price_People, int Price_Food,ref int Bonus, int Number_of_bonuses)
  384.         {
  385.             Console.Clear();
  386.             Menu(ref Item_Selection, Input_File);
  387.             switch (Item_Selection)
  388.             {
  389.                 case 1:
  390.                     if (Bu == false)
  391.                     {
  392.                         Console.Clear();
  393.                         if (Gold > Price_Gold && Tree > Price_Tree && Stone > Price_Stone && Metal > Price_Metal && People > Price_People && Food > Price_Food)//Price
  394.                         {
  395.                             Gold = Gold - Price_Gold;
  396.                             Tree = Tree - Price_Tree;
  397.                             Stone = Stone - Price_Stone;
  398.                             Metal = Metal - Price_Metal;
  399.                             People = People - Price_People;
  400.                             Food = Food - Price_Food;
  401.                             Bu = true;
  402.                             Bonus = Number_of_bonuses;//Number_of_bonuses
  403.                             Console.WriteLine("\n   Постройка совершена");//исправить визуализацию
  404.                             Console.ReadKey();
  405.                         }
  406.                         else
  407.                         {
  408.                             Console.WriteLine("\n   Не хватает ресурсов");//исправить визуализацию
  409.                             Console.ReadKey();
  410.                         }
  411.                     }
  412.                     else
  413.                     {
  414.                         Console.Clear();
  415.                         Console.WriteLine("\n   Постройка уже создана");//исправить визуализацию
  416.                         Console.ReadKey();
  417.                     }
  418.                     break;
  419.                 case 2:
  420.                     break;
  421.             }
  422.  
  423.         }
  424.         static void Improvement(ref int Item_Selection, string Input_File, ref int Gold, ref int Tree, ref int Stone, ref int Metal, ref int People, ref int Food, ref bool Bu, ref bool Max, int Price_Gold, int Price_Tree, int Price_Stone, int Price_Metal, int Price_People, int Price_Food, ref int Bonus_1, ref int Bonus_2, ref int Bonus_3, int Number_of_bonuses, ref int Number)
  425.         {
  426.             Console.Clear();
  427.             Menu(ref Item_Selection, Input_File);
  428.             switch (Item_Selection)
  429.             {
  430.                 case 1:
  431.                     if (Bu == true && Max == false)
  432.                     {
  433.                         Console.Clear();
  434.                         if (Gold > Price_Gold && Tree > Price_Tree && Stone > Price_Stone && Metal > Price_Metal && People > Price_People && Food > Price_Food)//Price
  435.                         {
  436.                             Gold = Gold - Price_Gold;
  437.                             Tree = Tree - Price_Tree;
  438.                             Stone = Stone - Price_Stone;
  439.                             Metal = Metal - Price_Metal;
  440.                             People = People - Price_People;
  441.                             Food = Food - Price_Food;
  442.                             if (Bonus_1 == 0)
  443.                             {
  444.                                 Bonus_1 = Number_of_bonuses;//Number_of_bonuses
  445.                                 Number = Number + 1;
  446.                             }
  447.                             else if (Bonus_2 == 0)
  448.                             {
  449.                                 Bonus_2 = Number_of_bonuses;//Number_of_bonuses
  450.                                 Number = Number + 1;
  451.                             }
  452.                             else if (Bonus_3 == 0)
  453.                             {
  454.                                 Bonus_3 = Number_of_bonuses;//Number_of_bonuses
  455.                                 Number = Number + 1;
  456.                                 Max = true;
  457.                             }
  458.                             Console.WriteLine("\n   Улучшение совершено");//исправить визуализацию
  459.                             Console.ReadKey();
  460.                         }
  461.                         else if (Bu == true && Max == true)
  462.                         {
  463.                             Console.WriteLine("\n   Максимальное улучшение уже достигнуто");//исправить визуализацию
  464.                             Console.ReadKey();
  465.                         }
  466.                         else
  467.                         {
  468.                             Console.WriteLine("\n   Не хватает ресурсов");//исправить визуализацию
  469.                             Console.ReadKey();
  470.                         }
  471.                     }
  472.                     else
  473.                     {
  474.                         Console.Clear();
  475.                         Console.WriteLine("\n   Постройка отсутствует");//исправить визуализацию
  476.                         Console.ReadKey();
  477.                     }
  478.                     break;
  479.                 case 2:
  480.                     break;
  481.             }
  482.         }
  483.         static void Information(ref bool Bu, ref int Number, string Inform_File)
  484.         {
  485.             if (Bu == true)
  486.             {
  487.                 Console.WriteLine(Inform_File + "(" + Number + ")\n");
  488.             }
  489.         }
  490.     }
  491. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement