Exemplo n.º 1
0
 public static void Shuffle()
 {
     var c = new Casino();
     Console.Clear();
     Console.WriteLine("Нaчнем ИГРУ!!!");
     var b = true;
     while (b)
     {
         if (_first)
         {
             c.Deserial();
             _first = false;
         }
         else
         {
             t = new Table();
         }
         Console.Clear();
         c.DistributeCart(true);
         c.DistributeCart(true);
         c.DistributeCart(false);
         c.DistributeCart(false);
         while (c.Result())
         {
             if (c.GetCountPlayer())
             {
                 c.DistributeCart(true);
                 c.DistributeCart(false);
             }
             else
                 if (c._choise)
                     c.DistributeCart(false);
                 else
                     break;
         }
         Console.Clear();
         c.Show();
         Console.WriteLine("Чтобы нaчать игру заново нажмите  <y>");
         if (Console.ReadLine() == "y") continue;
         b = false;
         Console.Clear();
         Console.WriteLine("Game over!");
         Console.ReadKey();
     }
 }
Exemplo n.º 2
0
 private void Deserial()
 {
     Console.WriteLine("\nВведите номер стола! <0-9>");
     var keypress = Console.ReadKey();
     switch (keypress.Key)
     {
         case (ConsoleKey)'1':
             {
                 _tableChoise = 1;
                 try
                 {
                     t = (Table)bf.Deserialize(_t1f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'2':
             {
                 _tableChoise = 2;
                 try
                 {
                     t = (Table)bf.Deserialize(_t2f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'3':
             {
                 _tableChoise = 3;
                 try
                 {
                     t = (Table)bf.Deserialize(_t3f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'4':
             {
                 _tableChoise = 4;
                 try
                 {
                     t = (Table)bf.Deserialize(_t4f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'5':
             {
                 _tableChoise = 5;
                 try
                 {
                     t = (Table)bf.Deserialize(_t5f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'6':
             {
                 _tableChoise = 6;
                 try
                 {
                     t = (Table)bf.Deserialize(_t6f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'7':
             {
                 _tableChoise = 7;
                 try
                 {
                     t = (Table)bf.Deserialize(_t7f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'8':
             {
                 _tableChoise = 8;
                 try
                 {
                     t = (Table)bf.Deserialize(_t8f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'9':
             {
                 _tableChoise = 9;
                 try
                 {
                     t = (Table)bf.Deserialize(_t9f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         case (ConsoleKey)'0':
             {
                 _tableChoise = 0;
                 try
                 {
                     t = (Table)bf.Deserialize(_t0f);
                 }
                 catch (Exception)
                 {
                     t = new Table();
                 }
                 break;
             }
         default:
             {
                 Console.Clear();
                 Console.WriteLine("\nНекоректный ввод! Попробуйте еще раз!!!");
                 Deserial();
                 break;
             }
     }
 }