Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using KAutoHelper;
- using System.Drawing;
- namespace AutoPUBG
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- //LoadData();
- }
- //void LoadData()
- //{
- // TOP_UP_BMP = (Bitmap)Bitmap.FromFile("Data//CickVaoGame.png");
- //}
- private void Button_Start(object sender, RoutedEventArgs e)
- {
- Task t = new Task(()=> {
- isStop = false;
- Auto();
- });
- t.Start();
- }
- bool isStop = false;
- void Auto()
- {
- // Lay ra Danh sach thiet bi
- List<string> devices = new List<string>();
- devices = KAutoHelper.ADBHelper.GetDevices();
- // Chay tung Device
- foreach (var deviceID in devices)
- {
- // Tao Ra Mot Luong Xu Ly
- Task t = new Task(()=> {
- // Lap Kich Ban
- while (true)
- {
- // Viet Auto O day
- if (isStop)
- return;
- KAutoHelper.ADBHelper.TapByPercent(deviceID, 37.3, 25.4);
- Delay(10);
- }
- });
- t.Start();
- }
- }
- void Delay(int delay)
- {
- while (delay > 0)
- {
- Thread.Sleep(TimeSpan.FromSeconds(1));
- delay--;
- if (isStop)
- break;
- }
- }
- private void Button_Stop(object sender, RoutedEventArgs e)
- {
- isStop = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement