• 蚂蚁森林自动收能量


    auto.waitFor();
    
    threads.start(function () { images.requestScreenCapture(); });
    while (!click("立即开始")) { };
    
    app.launchApp("支付宝");
    sleep(1500);
    click("蚂蚁森林");
    sleep(1500);
    
    function collect() {
        log(1111111111111111111);
        let point = depth(15).textStartsWith("收集能量").find();
        point.forEach(child => {
            log(child);
            let Rect = child.bounds();
            click(Rect.centerX(), Rect.centerY());
            sleep(1000);
        });
        log(2222222222222);
    }
    collect();
    sleep(1000);
    if(text("查看更多好友").exists()) {
        click("查看更多好友");
        sleep(1500);
    }
    
    // 29 160 110 1DA06E
    let f = depth(9).className("com.uc.webview.export.WebView").findOne();
    let cnt = 0;
    while(true) {
        if (cnt == 2) break;
        let t = f.child(0).child(0).child(0).child(0).child(1);
        let agg = t.children().find(visibleToUser(true).depth(15)); //只能找第一层的子控件,并返回集合
        let img = images.captureScreen();
    
        agg.forEach(child => {
            let point = child.child(4).bounds();
            // log(point);
            vis = images.findColorEquals(img, "#1DA06E", point.left, point.top, 69, 69);
            // images.pixel(image, x, y) colors.equals(color1, color2)
            vis2 = colors.equals("#FFFFFF", images.pixel(img, point.left+49, point.top+45));
            // vis2 = images.findColorEquals(img, "#FFFFFF", point.left, point.top, 49, 45);
            if (vis && vis2){
                log("找到了");
                click(child.bounds().centerX(), child.bounds().centerY());
                sleep(2000);
                collect();
                sleep(1000);
                back();
                sleep(1500);
            }
        });
    
        scrollable(true).find().scrollForward();
        
        //if (visibleToUser(true).depth(15).text("没有更多了").exists()) cnt++;
        let clip = images.read('/sdcard/mysl.jpg');
        var p = findImage(img, clip);
        if (p) cnt++;
        if (p) sleep(500);
        else sleep(1500);
    }
    
    // log(cnt);
    
    toast("end");
    

      

    东北日出西边雨 道是无情却有情
  • 相关阅读:
    hdu 5936 2016ccpc 杭州
    bzoj 1218: [HNOI2003]激光炸弹
    bzoj 1296: [SCOI2009]粉刷匠
    桃子到底有多少
    计算x的n次方
    计算x的n次方
    菲波拉契数列
    菲波拉契数列
    八皇后(N皇后)问题算法程序(回溯法)
    八皇后(N皇后)问题算法程序(回溯法)
  • 原文地址:https://www.cnblogs.com/ccut-ry/p/13664850.html
Copyright © 2020-2023  润新知