コードを使ってQQの年越し紅包を使います.


使用するライブラリはここから探します.
https://github.com/GameTerminator/dont-touch-white
キーコードはwhileループにドラゴを加えることです.
import com.android.chimpchat.adb.AdbBackend;
import com.android.chimpchat.core.IChimpDevice;

import java.io.IOException;

public class Main {

    public static void main(String[] args) throws IOException, InterruptedException {
        AdbBackend adbBack = new AdbBackend();
        IChimpDevice mChimpDevice = adbBack.waitForConnection();
        System.out.println("  ");
        long time = System.currentTimeMillis();
        while (System.currentTimeMillis() - time < 60000) {
            mChimpDevice.drag(300, 200, 400, 600, 10, 50);
            Thread.sleep(10);
        }
    }
}
もう一回修正しました.1から始まります.2は終了します.他はスキップします.

import com.android.chimpchat.adb.AdbBackend;
import com.android.chimpchat.core.IChimpDevice;

import java.io.IOException;
import java.util.Scanner;

public class Main {
       

    private static int action = 0;

    public static void main(String[] args) throws IOException, InterruptedException {
        AdbBackend adbBack = new AdbBackend();
        IChimpDevice mChimpDevice = adbBack.waitForConnection();
        System.out.println("  ");

        new Thread(new Runnable() {
            @Override
            public void run() {
                Scanner scanner = new Scanner(System.in);
                while (true) {
                    action = scanner.nextInt();
                    if (action == 2) {
                        return;
                    }
                }
            }
        }).start();

        long time = System.currentTimeMillis();
        int times = 0;
        while (System.currentTimeMillis() - time < 60000) {
            if (action == 1) {
                mChimpDevice.drag(300, 200, 400, 600, 10, 50);
                times++;
                System.out.println(times + " ");
            }
            if (action == 2) {
                return;
            }
            Thread.sleep(10);
        }

    }
}