zl程序教程

您现在的位置是:首页 >  工具

当前栏目

AutoJs学习-免ROOT免无障碍画圆球

学习 root 无障碍 AutoJs
2023-09-14 09:04:17 时间
往期文章分享

👉关于作者

众所周知,人生是一个漫长的流程,不断克服困难,不断反思前进的过程。在这个过程中会产生很多对于人生的质疑和思考,于是我决定将自己的思考,经验和故事全部分享出来,以此寻找共鸣 !!!
专注于Android/Unity和各种游戏开发技巧,以及各种资源分享(网站、工具、素材、源码、游戏等)
有什么需要欢迎私我,交流群让学习不再孤单

在这里插入图片描述

本文约3千字,新手阅读需要5分钟,复习需要2分钟收藏随时查阅不再迷路

👉实践过程

var window = floaty.window(
    <frame>
        <vertical>
            <linear>
                <button id="action" text="移动" gravity="center" w="40" h="40" color="#ffffff" bg="#77000000"/>
                <button id="nzh" text="画圆" w="40" h="40" color="#ffffff" bg="#77000000" margin="1 0 0 0"/>
            </linear>
            <img id="tp" w="81" h="0" bg="#44000000" />
            
        </vertical>
    </frame>
);



//记录按键被按下时的触摸坐标
var x = 0,
    y = 0;
//记录按键被按下时的悬浮窗位置
var windowX, windowY;
//记录按键被按下的时间以便判断长按等动作
var downTime;
window.action.setOnTouchListener(function(view, event) {
    switch (event.getAction()) {
        case event.ACTION_DOWN:
            x = event.getRawX();
            y = event.getRawY();
            windowX = window.getX();
            windowY = window.getY();
            downTime = new Date().getTime();
            return true;
        case event.ACTION_MOVE:
            //移动手指时调整悬浮窗位置
            
                window.setPosition(windowX + (event.getRawX() - x),
                    windowY + (event.getRawY() - y));
            // if(xs==1){ 
            //   window2.setPosition(windowX + (event.getRawX() - x),
            //    windowY + (event.getRawY() - y)+82);
            // }
            return true;
        case event.ACTION_UP:
            //手指弹起时如果偏移很小则判断为点击

            return true;
    }
    return true;
});
//requestScreenCapture();
function jt() {
    while (true) {
        if (tu = captureScreen()) {
            return tu;
            break;
        }
    }
}

window.nzh.on("touch_down", () => {
   //window.tp.setImageBitmap(jt().bitmap);
   threads.start(function(){
   sleep(1000);
    hy(360,550,300);});
});



function hy(prx, pry, prt) {
    kz=1;
    htx=prt*Math.cos(0*(Math.PI/180));
    hty=prt*Math.sin(0*(Math.PI/180));
    threads.start(function(){
        for(ix=0;ix<360;ix++){
        sleep(10);
        htx=prt*Math.cos(ix*(Math.PI/180));
        hty=prt*Math.sin(ix*(Math.PI/180));
        }
        kz=0;
        
        });
    threads.start(function() {
        touchdown(prx+htx,pry+hty,0);
        
        while(kz==1){
        sleep(5);
        touchmove(prx+htx,pry+hty,0);
        
        }
        touchup(prx+htx,pry+hty,0);
        
        });
}


function touchdown(pressx, pressy, pressn) {
    
        new android.app.Instrumentation().sendPointerSync(android.view.MotionEvent.obtain(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(),0, pressx, pressy, pressn));
  
}

function touchmove(pressx, pressy, pressn) {
   
      new android.app.Instrumentation().sendPointerSync(android.view.MotionEvent.obtain(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), 2, pressx, pressy, pressn));

}

function touchup(pressx, pressy, pressn) {
  
        new android.app.Instrumentation().sendPointerSync(android.view.MotionEvent.obtain(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), 1, pressx, pressy, pressn));
                          

}


while (true) {
    sleep(1000);
}

👉其他

📢作者:小空和小芝中的小空
📢转载说明-务必注明来源:https://zhima.blog.csdn.net/
📢这位道友请留步☁️,我观你气度不凡,谈吐间隐隐有王者霸气💚,日后定有一番大作为📝!!!旁边有点赞👍收藏🌟今日传你,点了吧,未来你成功☀️,我分文不取,若不成功⚡️,也好回来找我。

温馨提示点击下方卡片获取更多意想不到的资源。
空名先生