예제 #1
0
        static void Main(string[] args)
        {
            Airoplane plane = new Airoplane(2);

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Shift + →\t(+50 speed)\t" +
                              "Shift + ↑\t(+50 height)\n" +
                              "Shift + ←\t(-50 speed)\t" +
                              "Shift + ↓\t(-50 height)");
            Console.WriteLine("\t\tPress Any Key to start!!!");
            while (true)
            {
                Terminal.ShowDispInfo(plane);
                Console.WriteLine();
                Terminal.ShowPlainInfo(plane);
                Terminal.Manage(plane);
                if (plane.PlaneHeight == 0 && plane.Speed == 0 && plane.FlightType == PlainType.Landing)
                {
                    Console.WriteLine();
                    Console.WriteLine("Вы прошли испытание набрав: {0} штрафных очков!", plane.ErrorPoints());
                    break;
                }
                Thread.Sleep(50);
                Console.Clear();
            }

            Console.ReadLine();
        }
예제 #2
0
 public static void ShowPlainInfo(Airoplane plane)
 {
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine("Высота: {0}", plane.PlaneHeight);
     Console.WriteLine("Скорость: {0}", plane.Speed);
     Console.ForegroundColor = ConsoleColor.White;
 }
예제 #3
0
        public static void ShowDispInfo(Airoplane plane)
        {
            List <string> reports = plane.GetDispReports;

            Console.ForegroundColor = ConsoleColor.Green;
            reports.ForEach(rep => Console.WriteLine(rep));
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Black;
        }
예제 #4
0
        static void Main(string[] args)
        {
            int counter;

            do
            {
                LibFor7ISMBoot.Airoplane x = new Airoplane();
                LibFor7ISMBoot.Airoplane y = new Airoplane();
                Console.WriteLine($"Fly and Arive in same day? {x.IsArrivingToday()}");
                Console.WriteLine($"GetTotalTime: ");
                x.GetTotalTime();
                LibFor7ISMBoot.Product product = new Product();
                Console.WriteLine($"Total Price UAH:{product.GetTotalPriceInUAH()}\n");
                Console.WriteLine($"Price per one UAH:{product.GetPriceInUAH()}\n");
                Console.WriteLine($"Total Weight: {product.GetTotalWeight()}\n");
                Console.WriteLine("do you want to continue, input zero for no, another for yes\n");
                counter = getInt();
            } while (counter != 0);
        }
예제 #5
0
        public static void Manage(Airoplane plane)
        {
            ConsoleKeyInfo keyInfo = Console.ReadKey();

            if (keyInfo.Key == ConsoleKey.RightArrow || keyInfo.Key == ConsoleKey.LeftArrow)
            {
                if (keyInfo.Key == ConsoleKey.RightArrow)
                {
                    plane.Speed = 25;
                }
                else
                {
                    plane.Speed = -25;
                }
            }
            else if ((keyInfo.Key == ConsoleKey.RightArrow && keyInfo.Modifiers == ConsoleModifiers.Shift) ||
                     (keyInfo.Key == ConsoleKey.LeftArrow && keyInfo.Modifiers == ConsoleModifiers.Shift))
            {
                if (keyInfo.Key == ConsoleKey.RightArrow && keyInfo.Modifiers == ConsoleModifiers.Shift)
                {
                    plane.Speed = 50;
                }
                else
                {
                    plane.Speed = -50;
                }
            }

            if (keyInfo.Key == ConsoleKey.UpArrow || keyInfo.Key == ConsoleKey.DownArrow)
            {
                if (keyInfo.Key == ConsoleKey.UpArrow)
                {
                    plane.PlaneHeight = 25;
                }
                else
                {
                    plane.PlaneHeight = -25;
                }
            }
            else if ((keyInfo.Key == ConsoleKey.UpArrow && keyInfo.Modifiers == ConsoleModifiers.Shift) ||
                     (keyInfo.Key == ConsoleKey.DownArrow && keyInfo.Modifiers == ConsoleModifiers.Shift))
            {
                if (keyInfo.Key == ConsoleKey.UpArrow && keyInfo.Modifiers == ConsoleModifiers.Shift)
                {
                    plane.PlaneHeight = 50;
                }
                else
                {
                    plane.PlaneHeight = -50;
                }
            }


            if (keyInfo.Key == ConsoleKey.OemPlus)
            {
                plane.AddDispatcher();
            }
            else if (keyInfo.Key == ConsoleKey.OemMinus)
            {
                Console.Write("Введите номер диспетчера которого вы хотите удалить: ");
                int pos = Int32.Parse(Console.ReadLine().ToString());
                plane.RemoveDispatcher(pos);
            }

            if (keyInfo.Key != ConsoleKey.OemPlus && keyInfo.Key != ConsoleKey.OemMinus &&
                keyInfo.Key != ConsoleKey.UpArrow && keyInfo.Key != ConsoleKey.DownArrow &&
                keyInfo.Key != ConsoleKey.RightArrow && keyInfo.Key != ConsoleKey.LeftArrow &&
                (keyInfo.Key != ConsoleKey.UpArrow && keyInfo.Modifiers != ConsoleModifiers.Shift) &&
                (keyInfo.Key != ConsoleKey.DownArrow && keyInfo.Modifiers != ConsoleModifiers.Shift) &&
                (keyInfo.Key != ConsoleKey.LeftArrow && keyInfo.Modifiers != ConsoleModifiers.Shift) &&
                (keyInfo.Key != ConsoleKey.RightArrow && keyInfo.Modifiers != ConsoleModifiers.Shift))
            {
                plane.Speed       = 0;
                plane.PlaneHeight = 0;
            }
        }