Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void UImenu(string[] Text1, out int Choise, string oglav)
- {
- Choise = 0;
- //Выбор
- bool helperUI = true;
- //булевая переменная для вайла
- int menPoint = 1;
- //изначальный пункт меню
- while (helperUI)
- {
- Output(Text1, menPoint, oglav);
- //вывод меню
- ConsoleKeyInfo navigation = new ConsoleKeyInfo();
- navigation = Console.ReadKey();
- //считываем с клавиатуры
- switch (navigation.Key.ToString())
- {
- //если S Двигаемся вниз, если W - вниз,При F мы выходим из меню, и возвращаем наш выбор который можно вставить в Switch-case(if-else)
- case ("S"):
- menPoint++;
- if (menPoint >= Text1.Length)
- {
- menPoint = Text1.Length - 1;
- }
- break;
- case ("W"):
- menPoint--;
- if (menPoint <= 0)
- {
- menPoint = 0;
- }
- break;
- case ("F"):
- Choise = menPoint + 1;
- helperUI = false;
- break;
- }
- }
- Console.Clear();
- }
- static void Output(string[] Text2, int Menupoint, string oglav)
- {
- Console.Clear();
- Console.WriteLine(oglav);
- for (int count = 0; count < Text2.Length; count++)
- {
- if (count == Menupoint)
- {
- Console.Write("- ");
- }
- else
- {
- Console.Write(" ");
- }
- Console.Write(Text2[count] + "\n");
- }
- Console.WriteLine("\n\n\nНавигация - W/S,выбор - F");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement