public int DragnDpopHand(int n, int uhl, int caCars) { //caCars - cond available cars //n -needed cars FastCheck fc = new FastCheck(); HandMaking hm = new HandMaking(); Point[] a = new Point[] { PointsAndRectangles.pHandSlot1, PointsAndRectangles.pHandSlot2, PointsAndRectangles.pHandSlot3, PointsAndRectangles.pHandSlot4, PointsAndRectangles.pHandSlot5 }; Point[] b = new Point[] { PointsAndRectangles.GarageSlot1, PointsAndRectangles.GarageSlot2, PointsAndRectangles.GarageSlot3, PointsAndRectangles.GarageSlot4, PointsAndRectangles.GarageSlot5, PointsAndRectangles.GarageSlot6, PointsAndRectangles.GarageSlot7, PointsAndRectangles.GarageSlot8 }; int drag = 0; //сдвиги int x = 0; //слот гаража int h = 0; //слот руки, uhl использованные слоты в предыдущем подборе int neededcars = n; while (n > 0) { if (x == caCars) { break; } //x имеет значение и при нуле else { if (x > 3 && drag == 0) { Rat.DragnDropSlow(PointsAndRectangles.ds1, PointsAndRectangles.de1, 5); drag = 1; Thread.Sleep(1000); }//сдвиг if (x > 5 && drag == 1) { Rat.DragnDropSlow(PointsAndRectangles.ds2, PointsAndRectangles.de2, 5); drag = 2; Thread.Sleep(1000); }//сдвиг if (x > 7) { break; }//прерывание цикла в случае множества сломанных if (hm.CarFixed(x)) { NotePad.DoLog("Тачка " + (x + 1) + " исправна"); while (!fc.ItsGarage()) { Thread.Sleep(2000); } Rat.DragnDropSlow(b[x], a[h + uhl], 8); h++; n--; } else { NotePad.DoLog("Тачка " + x + " не готова"); } x++; } } int grayslots = fc.CheckHandSlot(uhl + 1, uhl + neededcars); NotePad.DoLog(grayslots + " слотов остались пустыми"); return(grayslots); }