public void ProcedureItems() { this.touch.GotoCenter(); Random rnd = new Random(); List <Point> items = new List <Point>(); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner2)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner2)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner2)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner2)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner1)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner2)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner2)); items.Add(Constants.GetPoint(Bot.Location.ButtonLeftInner3)); items.Add(Constants.GetPoint(Bot.Location.ButtonRightInner1)); int cnt = 0; while (!CheckIfInFactory()) { touch.ClickAt(Bot.Location.FirstFactory); BotApplication.Wait(200); cnt++; if (cnt > 10) { break; } } //cnt = 0; //while (!CheckIfInFactory()) //{ // touch.ClickAt(new Point(830, 538)); // BotApplication.Wait(200); // cnt++; // if (cnt > 10) break; //} if (!CheckIfInFactory()) { ProcedureItems(); return; } //touch.Swipe(Constants.GetPoint(Bot.Location.FactoryResource1), Constants.GetPoint(Bot.Location.CentreMap)); //424 678 for (int j = 0; j < 6; j++) // 5 factories { //CollectFactoryItem(5); int[] AllStatus = touch.CheckFactoryAllSlotStatus(); log.Info("Status of all 5 slots :" + string.Join(",", AllStatus)); int emptyCount = 0; for (int i = 0; i < AllStatus.Length; i++) { int x = 358 + 142 * i; int y = 675; if (AllStatus[i] == 1) { touch.ClickAt(new Point(x, y)); BotApplication.Wait(20); emptyCount++; } if (AllStatus[i] == 0) { emptyCount++; } } /* * * for (int i = 0; i < AllStatus.Length; i++) * { * int x = 429 + 142 * i; * int y = 675; * if (AllStatus[i] == 1) * { * touch.ClickAt(new Point(x, y)); * BotApplication.Wait(20); * emptyCount++; * } * if (AllStatus[i] == 0) * { * emptyCount++; * } * } */ for (int i = 0; i < emptyCount; i++) { Point pr = items[rnd.Next(items.Count)]; touch.Swipe(pr, Constants.GetPoint(Bot.Location.CentreMap)); // procedure BotApplication.Wait(30); } Bot.BotApplication.Wait(100); nextFactory(); Bot.BotApplication.Wait(100); } if (CheckIfInFactory()) { touch.sendRawEvent("1 1 1"); touch.sendRawEvent("0 0 0"); // touch.ClickAt(new Point(655, 77)); /* * /dev/input/event7: 0001 0001 00000001 * /dev/input/event7: 0000 0000 00000000 */ } }