您的位置:首页 > 编程语言

使用代码刷QQ的跨年红包

2015-12-31 18:36 288 查看
使用的库从这里找:

https://github.com/GameTerminator/dont-touch-white

关键代码就是一个while循环加上drag。

[code]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退出,其他跳过。

[code]
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);
        }

    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: