Advertisement
Guest User

menu

a guest
Nov 12th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.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 test3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int choose;
  14.             string[,] equiped = new string[1,3];
  15.             equiped[0, 0] = "Нет оружия";
  16.             equiped[0, 1] = "0";
  17.             equiped[0, 2] = "0";
  18.             int currentEquiped = 0;
  19.             int stat = 0;
  20.  
  21.             do
  22.             {
  23.                 Console.WriteLine("Это меню оружия");
  24.                 Console.WriteLine();
  25.                 Console.WriteLine("Сейчас на персонаже:");
  26.                 Console.WriteLine($"Экипировано: {equiped[currentEquiped, 0]}");
  27.                 Console.WriteLine($"Урон: {equiped[currentEquiped, 1]}");
  28.                 Console.WriteLine($"Скорострельность: {equiped[currentEquiped, 2]}");
  29.  
  30.                 Console.WriteLine();
  31.                
  32.                 Console.WriteLine("Ваш рюкзак");
  33.                
  34.                 for (int i = 0; i < equiped.GetLength(0); i++)
  35.                 {
  36.                     Console.WriteLine($"{i + 1}. {equiped[i, 0]}");
  37.                 }
  38.  
  39.                 Console.WriteLine();
  40.                 Console.WriteLine("Меню");
  41.                 Console.WriteLine("1. Добавить оружие");
  42.                 Console.WriteLine("2. Стастика оружия");
  43.                 Console.WriteLine("3. Экипировать оружие");
  44.                 Console.WriteLine("4. Выйти из инвентаря");
  45.  
  46.                 choose = Convert.ToInt32(Console.ReadLine());
  47.                
  48.                 Console.Clear();
  49.  
  50.                 switch (choose)
  51.                 {
  52.                     case 1:
  53.                         Console.WriteLine("Меню добавления оружия\n");
  54.  
  55.                         string[,] weapon = new string[equiped.GetLength(0) + 1, equiped.GetLength(1)];
  56.                        
  57.                         for (int i = 0; i < equiped.GetLength(0); i++)
  58.                         {
  59.                             for (int j = 0; j < equiped.GetLength(1); j++)
  60.                             {
  61.                                 weapon[i, j] = equiped[i, j];
  62.                             }
  63.                         }
  64.  
  65.                         Console.WriteLine("Введите название оружия: ");
  66.                         weapon[equiped.GetLength(0) - 1, 0] = Console.ReadLine();
  67.  
  68.                         Console.WriteLine("Введите урон оружия: ");
  69.                         weapon[equiped.GetLength(0) - 1, 1] = Console.ReadLine();
  70.  
  71.                         Console.WriteLine("Введите скорострельность: ");
  72.                         weapon[equiped.GetLength(0) - 1, 2] = Console.ReadLine();
  73.                        
  74.                         equiped = weapon;
  75.                        
  76.                         break;
  77.  
  78.                     case 2:
  79.  
  80.                         Console.WriteLine("Меню статистики оружия\n");
  81.                         Console.WriteLine("Выберите номер оружия: ");
  82.  
  83.                         for (int i = 0; i < equiped.GetLength(0); i++)
  84.                         {
  85.                             Console.WriteLine($"{i + 1}. {equiped[i, 0]}");
  86.                         }
  87.  
  88.                         stat = Convert.ToInt32(Console.ReadLine()) - 1;
  89.  
  90.                         Console.WriteLine("Оружие: " + equiped[stat, 0]);
  91.                         Console.WriteLine("Урон: " + equiped[stat, 1]);
  92.                         Console.WriteLine("Скорострельность: " + equiped[stat, 2]);
  93.                         Console.ReadLine();
  94.                        
  95.                         break;
  96.                    
  97.                     case 3:
  98.  
  99.                         Console.WriteLine("Меню экипировки оружия\n");
  100.                         Console.WriteLine("Выберите номер оружия: ");
  101.                        
  102.                         for (int i = 0; i < equiped.GetLength(0); i++)
  103.                         {
  104.                             Console.WriteLine($"{i + 1}. {equiped[i, 0]}");
  105.                         }
  106.                        
  107.                         currentEquiped = Convert.ToInt32(Console.ReadLine()) - 1;
  108.  
  109.                         break;
  110.  
  111.                     case 4:
  112.                        
  113.                         Console.WriteLine("До встречи");
  114.                         Console.ReadLine();
  115.                        
  116.                         break;
  117.                 }
  118.                 Console.Clear();
  119.             } while (choose != 4);
  120.         }
  121.     }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement