コード例 #1
0
 public override typeCrash Handle(typeCrash TC, int route, Label logs)
 {
     logs.Text += $"\n Путь {route}: Механик выехал для устранения проблемы.";
     if (TC.mechanic == true)
     {
         logs.Text += $"\n Путь {route}: Механик устранил проблему.";
     }
     else
     {
         logs.Text += $"\n Путь {route}: Механик не выявил проблемы.";
     }
     TC.mechanic = false;
     if (next != null)
     {
         if (TC.rail == true)
         {
             logs.Text += $"\n Путь {route}: Пути все ещё неисправны.";
             TC         = next.Handle(TC, route, logs);
         }
         else
         {
             logs.Text += $"\n Путь {route}: Пути исправны!";
         }
     }
     return(TC);
 }
コード例 #2
0
ファイル: Tram.cs プロジェクト: Kriiist/Ind_Task
        /*public void Move()
         * {
         *
         *
         *  PictureBox tr = new PictureBox();
         *  tr.Visible = true;
         *  LS.line[LineNum].linePart[LastPart].Pic.Visible = true;
         *  for (; LastPart < LS.line[LineNum].CountOfStations - 2; LastPart++)
         *  {
         *      Thread.Sleep(1000);
         *      LS.line[LineNum].linePart[LastPart].Pic.Visible = false;
         *      if (LastPart == LS.line[LineNum].CountOfStations - 3)
         *      {
         *          LastPart = 0;
         *      }
         *      LS.line[LineNum].linePart[LastPart + 1].Pic.Visible = true;
         *  }
         * }*/

        public typeCrash checkCrash()
        {
            Random rnd  = new Random();
            int    rand = rnd.Next(1, 500);

            if (rand <= 1)
            {
                int [] ran = new int[3];
                ran[0] = rnd.Next(1, 90);
                ran[1] = rnd.Next(1, 90);
                ran[2] = rnd.Next(1, 90);
                typeCrash TC = new typeCrash();
                for (int i = 0; i < 3; i++)
                {
                    if (ran[i] <= 30)
                    {
                        TC.electric = true;
                    }
                    if (ran[i] > 30 && ran[i] <= 60)
                    {
                        TC.mechanic = true;
                    }
                    if (ran[i] > 60 && ran[i] <= 90)
                    {
                        TC.rail = true;
                    }
                }
                SystemSounds.Exclamation.Play();
                return(TC);
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
        public override typeCrash routeFix(typeCrash TC, int route, Label logs)
        {
            Electric   ER5 = new Electric();
            Mechanic   MR5 = new Mechanic();
            RailMaster RR5 = new RailMaster();

            ER5.next = MR5;
            MR5.next = RR5;
            RR5.next = null;

            TC = ER5.Handle(TC, route, logs);
            return(TC);
        }
コード例 #4
0
 public override typeCrash Handle(typeCrash TC, int route, Label logs)
 {
     logs.Text += $"\n Путь {route}: Стрелочник выехал для устранения проблемы.";
     if (TC.rail == true)
     {
         logs.Text += $"\n Путь {route}: Стрелочник устранил проблему.";
     }
     else
     {
         logs.Text += $"\n Путь {route}: Стрелочник не выявил проблемы.";
     }
     TC.rail    = false;
     logs.Text += $"\n Путь {route}: Пути исправны!";
     return(TC);
 }
コード例 #5
0
        public override void ShowCrash(int num, typeCrash TC)
        {
            TT = new ToolTip();
            //TT.SetToolTip(LPR5.linePart[num].Pic, "error");
            string error = "";

            if (TC.electric == true)
            {
                error += "поломка электроники ";
            }
            if (TC.mechanic == true)
            {
                error += "поломка механики ";
            }
            if (TC.rail == true)
            {
                error += "поломка путей";
            }
            TT.Show(error, LPR5.linePart[num].Pic);
        }
コード例 #6
0
 public abstract typeCrash FixCrash(int route, typeCrash TC, Label logs);
コード例 #7
0
 public abstract void ShowCrash(int num, typeCrash TC);
コード例 #8
0
 public abstract typeCrash routeFix(typeCrash TC, int route, Label logs);
コード例 #9
0
        public override typeCrash FixCrash(int num, typeCrash TC, Label logs)
        {
            typeCrash T = RP5.routeFix(TC, num, logs);

            return(T);
        }
コード例 #10
0
 public abstract typeCrash Handle(typeCrash TC, int route, Label logs);
コード例 #11
0
 public crashInfo()
 {
     TC    = null;
     route = 0;
     LP    = 0;
 }