Advertisement
Guest User

3.7

a guest
Oct 15th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.76 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.  
  7. namespace work
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             Random random = new Random();
  15.             int currentWeapon = 0;
  16.             int deletingWeapon;
  17.             string[] weaponsName = new string[0];
  18.             int[] weaponsDamage = new int[0];
  19.             int[] weaponsSpeed = new int[0];
  20.  
  21.             Console.SetCursorPosition(45, 2);
  22.             Console.WriteLine("Арсенал ");
  23.             Console.SetCursorPosition(3, 4);
  24.             Console.WriteLine("Экирировано: Ничего");
  25.             Console.SetCursorPosition(3, 5);
  26.             Console.WriteLine("Скорострельность: нет");
  27.             Console.SetCursorPosition(3, 6);
  28.             Console.WriteLine("Урон: нет");
  29.             Console.SetCursorPosition(3, 8);
  30.             Console.WriteLine("МЕНЮ ");
  31.             Console.SetCursorPosition(3, 9);
  32.             Console.WriteLine("1) Добавить оружие ");
  33.             Console.SetCursorPosition(3, 10);
  34.             Console.WriteLine("2) Удалить оружие ");
  35.             Console.SetCursorPosition(3, 11);
  36.             Console.WriteLine("3) Экипировать оружие ");
  37.             Console.SetCursorPosition(75, 10);
  38.             Console.Write("Инвентарь");
  39.  
  40.             do
  41.             {
  42.                 for (int i = 0; i < weaponsName.Length; i++)
  43.                 {
  44.                     Console.SetCursorPosition(85, 10 + 1 * i);
  45.                     Console.Write(" " + (i + 1) + " " + weaponsName[i]);
  46.                 }
  47.  
  48.                 Console.SetCursorPosition(0, 12);
  49.                 Console.WriteLine("                                                           ");
  50.                 Console.SetCursorPosition(0, 12);
  51.                 ConsoleKeyInfo userInput = Console.ReadKey();
  52.                 switch (userInput.Key)
  53.                 {
  54.                     case ConsoleKey.D1:
  55.                         if (weaponsName.Length > 8)
  56.                         {
  57.                             Console.SetCursorPosition(5, 14);
  58.                             Console.WriteLine("Инвентарь заполнен                                             ");
  59.                             break;
  60.                         }
  61.                         string[] tempWeaponName = new string[weaponsName.Length + 1];
  62.                         for (int i = 0; i < weaponsName.Length; i++)
  63.                         {
  64.                             tempWeaponName[i] = weaponsName[i];
  65.                         }
  66.                         switch (random.Next(0, 3))
  67.                         {
  68.                             case 0:
  69.                                 tempWeaponName[weaponsName.Length] = "Плазмо";
  70.                                 break;
  71.                             case 1:
  72.                                 tempWeaponName[weaponsName.Length] = "Луче";
  73.                                 break;
  74.                             case 2:
  75.                                 tempWeaponName[weaponsName.Length] = "Мега";
  76.                                 break;
  77.                         }
  78.                         switch (random.Next(0, 3))
  79.                         {
  80.                             case 0:
  81.                                 tempWeaponName[weaponsName.Length] = tempWeaponName[weaponsName.Length] + "бластер          ";
  82.                                 break;
  83.                             case 1:
  84.                                 tempWeaponName[weaponsName.Length] = tempWeaponName[weaponsName.Length] + "мёт          ";
  85.                                 break;
  86.                             case 2:
  87.                                 tempWeaponName[weaponsName.Length] = tempWeaponName[weaponsName.Length] + "Тесак            ";
  88.                                 break;
  89.                         }
  90.                         weaponsName = tempWeaponName;
  91.                        
  92.                         int[] tempWeaponsDamage = new int[weaponsDamage.Length + 1];
  93.                         for (int i = 0; i < weaponsDamage.Length; i++)
  94.                         {  
  95.                             tempWeaponsDamage[i] = weaponsDamage[i];
  96.                         }
  97.                         tempWeaponsDamage[weaponsDamage.Length] = random.Next(10, 99);
  98.                         weaponsDamage = tempWeaponsDamage;
  99.  
  100.                         int[] tempWeaponsSpeed = new int[weaponsSpeed.Length + 1];
  101.                         for (int i = 0; i < weaponsSpeed.Length; i++)
  102.                         {
  103.                             tempWeaponsSpeed[i] = weaponsSpeed[i];
  104.                         }
  105.                         tempWeaponsSpeed[weaponsSpeed.Length] = random.Next(10, 99);
  106.                         weaponsSpeed = tempWeaponsSpeed;
  107.  
  108.                         Console.SetCursorPosition(5, 14);
  109.                         Console.Write("Добавлен " + weaponsName[weaponsName.Length - 1]);
  110.                         Console.SetCursorPosition(40, 14);
  111.                         Console.Write("скорострельность " + weaponsSpeed[weaponsSpeed.Length - 1] + " ");
  112.                         Console.SetCursorPosition(60, 14);
  113.                         Console.Write(" урон " + weaponsDamage[weaponsDamage.Length - 1] + " ");
  114.                         break;
  115.                     case ConsoleKey.D2:
  116.                         if (weaponsName.Length == 0)
  117.                         {
  118.                             Console.SetCursorPosition(5, 14);
  119.                             Console.WriteLine("Инвентарь пуст                                                 ");
  120.                             break;
  121.                         }
  122.                         Console.SetCursorPosition(0, 12);
  123.                         Console.Write("выберите оружие из инвентаря ");
  124.                         deletingWeapon = Convert.ToInt32(Console.ReadLine());
  125.  
  126.                         if (currentWeapon == deletingWeapon)
  127.                         {
  128.                             Console.SetCursorPosition(3, 4);
  129.                             Console.WriteLine("Экирировано: Ничего                ");
  130.                             Console.SetCursorPosition(3, 5);
  131.                             Console.WriteLine("Скорострельность: нет");
  132.                             Console.SetCursorPosition(3, 6);
  133.                             Console.WriteLine("Урон: нет");
  134.                             Console.SetCursorPosition(3, 8);
  135.                         }
  136.                         if (deletingWeapon > weaponsName.Length)
  137.                         {
  138.                             Console.SetCursorPosition(5, 14);
  139.                             Console.WriteLine("Нет такого оружия                                                ");
  140.                             break;
  141.                         }
  142.  
  143.                         Console.SetCursorPosition(5, 14);
  144.                         Console.Write("Удалён " + weaponsName[deletingWeapon - 1] + "                                          ");
  145.                         string[] delWeaponName = new string[weaponsName.Length - 1];
  146.                         int[] delWeaponsDamage = new int[weaponsDamage.Length - 1];
  147.                         int[] delWeaponsSpeed = new int[weaponsSpeed.Length - 1];
  148.                         for (int i = 0; i < deletingWeapon - 1; i++)
  149.                         {
  150.                             delWeaponName[i] = weaponsName[i];
  151.                             delWeaponsDamage[i] = weaponsDamage[i];
  152.                             delWeaponsSpeed[i] = weaponsSpeed[i];
  153.                         }
  154.                         for (int i = deletingWeapon - 1; i < delWeaponName.Length; i++)
  155.                         {
  156.                             delWeaponName[i] = weaponsName[i + 1];
  157.                             delWeaponsDamage[i] = weaponsDamage[i + 1];
  158.                             delWeaponsSpeed[i] = weaponsSpeed[i + 1];
  159.                         }
  160.                         weaponsName = delWeaponName;
  161.                         weaponsDamage = delWeaponsDamage;
  162.                         weaponsSpeed = delWeaponsSpeed;
  163.  
  164.                         Console.SetCursorPosition(85, 10 + 1 * weaponsName.Length);
  165.                         Console.Write("                                        ");
  166.                         break;
  167.                     case ConsoleKey.D3:
  168.                         Console.SetCursorPosition(0, 12);
  169.                         Console.Write("выберите оружие из инвентаря ");
  170.                         currentWeapon = Convert.ToInt32(Console.ReadLine());
  171.                         if (currentWeapon > weaponsName.Length)
  172.                         {
  173.                             Console.SetCursorPosition(5, 14);
  174.                             Console.WriteLine("Такого оружия нет                                                 ");
  175.                             break;
  176.                         }
  177.                         Console.SetCursorPosition(3, 4);
  178.                         Console.WriteLine("Экирировано: " + weaponsName[currentWeapon - 1]);
  179.                         Console.SetCursorPosition(3, 5);
  180.                         Console.WriteLine("Скорострельность: " + weaponsSpeed[currentWeapon - 1] + "  ");
  181.                         Console.SetCursorPosition(3, 6);
  182.                         Console.WriteLine("Урон: " + weaponsDamage[currentWeapon - 1] + "  ");
  183.                         break;
  184.                     default:
  185.                         Console.SetCursorPosition(0, 20);
  186.                         Console.WriteLine("ERROR");
  187.                         break;
  188.                 }
  189.             } while (true);
  190.         }
  191.     }
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement